gitea work flow update
This commit is contained in:
@@ -0,0 +1,102 @@
|
|||||||
|
name: CI/CD - ERP Core Monorepo
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- Production
|
||||||
|
types:
|
||||||
|
- closed
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
backend-build-and-deploy:
|
||||||
|
name: Build & Deploy ERP Core Backend
|
||||||
|
runs-on: linux
|
||||||
|
if: github.event.pull_request.merged == true
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
run: |
|
||||||
|
git clone \
|
||||||
|
--depth 1 \
|
||||||
|
--branch Production \
|
||||||
|
https://oauth2:${{ secrets.ERPCORE }}@gitea.hexdive.com/New_REP_SYSTEM/ERP-core.git \
|
||||||
|
.
|
||||||
|
|
||||||
|
- name: Restore backend
|
||||||
|
run: dotnet restore Backend/ERPCore.sln
|
||||||
|
|
||||||
|
- name: Publish backend
|
||||||
|
run: |
|
||||||
|
rm -rf /tmp/erpcore-deploy
|
||||||
|
mkdir -p /tmp/erpcore-deploy
|
||||||
|
dotnet publish Backend/ERPCore/ERPCore.csproj \
|
||||||
|
-c Release \
|
||||||
|
-r linux-x64 \
|
||||||
|
--self-contained true \
|
||||||
|
-o /tmp/erpcore-deploy
|
||||||
|
|
||||||
|
- name: Stop backend service
|
||||||
|
run: systemctl stop erpcore.service
|
||||||
|
|
||||||
|
- name: Copy backend to deploy folder
|
||||||
|
run: |
|
||||||
|
mkdir -p /home/erp/core/publish
|
||||||
|
rm -rf /home/erp/core/publish/*
|
||||||
|
cp -r /tmp/erpcore-deploy/* /home/erp/core/publish/
|
||||||
|
|
||||||
|
- name: Fix backend ownership and permissions
|
||||||
|
run: |
|
||||||
|
chown -R erpcore:erpcore /home/erp/core/publish
|
||||||
|
find /home/erp/core/publish -type d -exec chmod 755 {} +
|
||||||
|
find /home/erp/core/publish -type f -exec chmod 644 {} +
|
||||||
|
chmod +x /home/erp/core/publish/ERPCore
|
||||||
|
|
||||||
|
- name: Restart backend service
|
||||||
|
run: systemctl restart erpcore.service
|
||||||
|
|
||||||
|
- name: Verify backend
|
||||||
|
run: |
|
||||||
|
systemctl is-active erpcore.service && echo "Backend service running" || echo "Backend service failed"
|
||||||
|
|
||||||
|
frontend-build-and-deploy:
|
||||||
|
name: Build & Deploy ERP Core Frontend
|
||||||
|
runs-on: linux
|
||||||
|
needs: backend-build-and-deploy
|
||||||
|
if: github.event.pull_request.merged == true
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
run: |
|
||||||
|
git clone \
|
||||||
|
--depth 1 \
|
||||||
|
--branch Production \
|
||||||
|
https://oauth2:${{ secrets.ERPCORE }}@gitea.hexdive.com/New_REP_SYSTEM/ERP-core.git \
|
||||||
|
.
|
||||||
|
|
||||||
|
- name: Build frontend Docker image
|
||||||
|
run: docker build -t erpcore-frontend:latest Frontend/erp-system
|
||||||
|
|
||||||
|
- name: Stop & remove existing frontend container
|
||||||
|
run: |
|
||||||
|
docker stop erpcore-frontend 2>/dev/null || true
|
||||||
|
docker rm erpcore-frontend 2>/dev/null || true
|
||||||
|
|
||||||
|
- name: Start frontend container
|
||||||
|
run: |
|
||||||
|
docker run -d \
|
||||||
|
--name erpcore-frontend \
|
||||||
|
-p 6702:6702 \
|
||||||
|
--add-host=host.docker.internal:host-gateway \
|
||||||
|
-e BACKEND_ORIGIN=http://host.docker.internal:6701 \
|
||||||
|
--restart unless-stopped \
|
||||||
|
--memory="512m" \
|
||||||
|
--cpus="1.0" \
|
||||||
|
--cap-drop ALL \
|
||||||
|
--security-opt no-new-privileges \
|
||||||
|
erpcore-frontend:latest
|
||||||
|
|
||||||
|
- name: Remove old frontend images
|
||||||
|
run: docker image prune -f
|
||||||
|
|
||||||
|
- name: Verify frontend
|
||||||
|
run: |
|
||||||
|
docker ps --filter name=erpcore-frontend --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" \
|
||||||
|
| grep erpcore-frontend && echo "Frontend container running" || echo "Frontend container failed"
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"applicationUrl": "http://localhost:5224",
|
"applicationUrl": "http://localhost:6701",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"applicationUrl": "https://localhost:7112;http://localhost:5224",
|
"applicationUrl": "https://localhost:7112;http://localhost:6701",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"DefaultConnection": "Host=localhost;Port=5432;Database=ERPCore;Username=root;Password=root"
|
"DefaultConnection": "Host=localhost;Port=5432;Database=ERPCoreTest;Username=postgres;Password=post@hexdive"
|
||||||
},
|
},
|
||||||
|
"Urls": "http://0.0.0.0:6701",
|
||||||
"Auth": {
|
"Auth": {
|
||||||
"Issuer": "AuthHex",
|
"Issuer": "AuthHex",
|
||||||
"Audience": "AuthHexClient",
|
"Audience": "AuthHexClient",
|
||||||
@@ -16,7 +17,7 @@
|
|||||||
"RequiredRoleCode": ""
|
"RequiredRoleCode": ""
|
||||||
},
|
},
|
||||||
"AuthHex": {
|
"AuthHex": {
|
||||||
"BaseUrl": "http://localhost:5602"
|
"BaseUrl": "http://localhost:6703"
|
||||||
},
|
},
|
||||||
"FileStorage": {
|
"FileStorage": {
|
||||||
"RootPath": "App_Data/hr-documents",
|
"RootPath": "App_Data/hr-documents",
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
node_modules
|
||||||
|
.next
|
||||||
|
out
|
||||||
|
build
|
||||||
|
coverage
|
||||||
|
.vercel
|
||||||
|
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.local.example
|
||||||
|
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
.pnpm-debug.log*
|
||||||
|
|
||||||
|
Dockerfile
|
||||||
|
.dockerignore
|
||||||
@@ -4,4 +4,4 @@
|
|||||||
#
|
#
|
||||||
# Use the backend's HTTP port: its HTTPS port serves a self-signed dev cert that the
|
# Use the backend's HTTP port: its HTTPS port serves a self-signed dev cert that the
|
||||||
# proxy will refuse.
|
# proxy will refuse.
|
||||||
BACKEND_ORIGIN=http://localhost:5224
|
BACKEND_ORIGIN=http://localhost:6701
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
FROM node:22-alpine AS deps
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
FROM node:22-alpine AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM node:22-alpine AS runner
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
ENV PORT=6702
|
||||||
|
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci --omit=dev && npm cache clean --force
|
||||||
|
|
||||||
|
COPY --from=builder /app/.next ./.next
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
COPY --from=builder /app/next.config.ts ./next.config.ts
|
||||||
|
|
||||||
|
EXPOSE 6702
|
||||||
|
|
||||||
|
CMD ["npm", "run", "start"]
|
||||||
@@ -8,7 +8,7 @@ import path from "path"
|
|||||||
//
|
//
|
||||||
// Defaults to the backend's HTTP port: the HTTPS port uses a self-signed dev cert that
|
// Defaults to the backend's HTTP port: the HTTPS port uses a self-signed dev cert that
|
||||||
// this proxy would reject.
|
// this proxy would reject.
|
||||||
const BACKEND_ORIGIN = process.env.BACKEND_ORIGIN ?? "http://localhost:5224"
|
const BACKEND_ORIGIN = process.env.BACKEND_ORIGIN ?? "http://localhost:6701"
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
turbopack: {
|
turbopack: {
|
||||||
|
|||||||
Reference in New Issue
Block a user