Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a583f80e5 | |||
| 83e0335504 | |||
| 513343b62a | |||
| 256e39ccff | |||
| efb37fce7a | |||
| 01fc2582b6 | |||
| 39a2dc60be | |||
| 3b87a6e421 | |||
| 2a7a44cc27 | |||
| c7cf63e7de | |||
| d1044e4728 | |||
| 821e96e011 | |||
| d6f973202d | |||
| 1d5a5cf68e | |||
| 8e472ac996 | |||
| 666979cf22 | |||
| eb36e0acfa | |||
| 0ff39e9e58 | |||
| afa9928dcc |
@@ -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,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:5224",
|
||||
"applicationUrl": "http://localhost:6701",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7112;http://localhost:5224",
|
||||
"applicationUrl": "https://localhost:7112;http://localhost:6701",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"Issuer": "AuthHex",
|
||||
"Audience": "AuthHexClient",
|
||||
@@ -16,7 +17,7 @@
|
||||
"RequiredRoleCode": ""
|
||||
},
|
||||
"AuthHex": {
|
||||
"BaseUrl": "http://localhost:5602"
|
||||
"BaseUrl": "http://localhost:6703"
|
||||
},
|
||||
"FileStorage": {
|
||||
"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
|
||||
# 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
|
||||
// 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 = {
|
||||
turbopack: {
|
||||
|
||||
Reference in New Issue
Block a user