Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4010f7bbe | ||
|
|
3d43b3c206 | ||
|
|
7144ac86cb | ||
|
|
10bd0a085f |
+55
-12
@@ -1,36 +1,79 @@
|
|||||||
name: Build and Deploy
|
name: CI/CD Pipeline
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [ master, main ]
|
||||||
- master
|
pull_request:
|
||||||
|
branches: [ master, main ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
validate-and-build:
|
||||||
|
name: Build & Validate
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Frontend Dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run TypeScript & Lint Checks
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
- name: Build Frontend Application
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Validate Backend
|
||||||
|
run: |
|
||||||
|
cd backend
|
||||||
|
npm ci
|
||||||
|
node --check server.js database.js mail.js
|
||||||
|
|
||||||
|
docker-build-and-push:
|
||||||
|
name: Build & Push Docker Images
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: validate-and-build
|
||||||
|
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log in to Gitea Container Registry
|
- name: Log in to Gitea Container Registry
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: git.digifox.live
|
registry: git.digifox.live
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITEA_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push Web
|
- name: Build and Push Frontend Image
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: git.digifox.live/digifoxkurama/titan-web:latest
|
tags: git.digifox.live/digifoxkurama/titan-web:latest
|
||||||
|
|
||||||
- name: Build and push API
|
- name: Build and Push Backend Image
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./backend
|
context: ./backend
|
||||||
file: ./backend/Dockerfile
|
file: ./backend/Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: git.digifox.live/digifoxkurama/titan-api:latest
|
tags: git.digifox.live/digifoxkurama/titan-api:latest
|
||||||
|
|
||||||
|
- name: Trigger Coolify Zero-Downtime Redeploy
|
||||||
|
run: |
|
||||||
|
curl -s -X POST \
|
||||||
|
-H "Authorization: Bearer ${{ secrets.COOLIFY_API_TOKEN || '8|fPDOJYtoML5NxxGMJdN4OHbCIfyME8vwcvYtlWab7939e30c' }}" \
|
||||||
|
https://deploy.digifox.live/api/v1/services/lbvulal59jsvjqi4rvfw8i4q/restart
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
name: CI/CD Pipeline
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master, main ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master, main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate-and-build:
|
||||||
|
name: Build & Validate
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Frontend Dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run TypeScript & Lint Checks
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
- name: Build Frontend Application
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Validate Backend
|
||||||
|
run: |
|
||||||
|
cd backend
|
||||||
|
npm ci
|
||||||
|
node --check server.js database.js mail.js
|
||||||
|
|
||||||
|
docker-build-and-push:
|
||||||
|
name: Build & Push Docker Images
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: validate-and-build
|
||||||
|
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Gitea Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: git.digifox.live
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITEA_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and Push Frontend Image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: git.digifox.live/digifoxkurama/titan-web:latest
|
||||||
|
|
||||||
|
- name: Build and Push Backend Image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: ./backend
|
||||||
|
file: ./backend/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: git.digifox.live/digifoxkurama/titan-api:latest
|
||||||
|
|
||||||
|
- name: Trigger Coolify Zero-Downtime Redeploy
|
||||||
|
run: |
|
||||||
|
curl -s -X POST \
|
||||||
|
-H "Authorization: Bearer ${{ secrets.COOLIFY_API_TOKEN || '8|fPDOJYtoML5NxxGMJdN4OHbCIfyME8vwcvYtlWab7939e30c' }}" \
|
||||||
|
https://deploy.digifox.live/api/v1/services/lbvulal59jsvjqi4rvfw8i4q/restart
|
||||||
@@ -24,6 +24,7 @@ RUN npm run build
|
|||||||
FROM nginx:alpine AS production
|
FROM nginx:alpine AS production
|
||||||
# Copy built assets from the build stage to Nginx
|
# Copy built assets from the build stage to Nginx
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
COPY --from=build /app/3dmodels /usr/share/nginx/html/3dmodels
|
||||||
# Copy custom nginx config
|
# Copy custom nginx config
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
# Expose port 80 for Nginx
|
# Expose port 80 for Nginx
|
||||||
|
|||||||
@@ -1,17 +1,21 @@
|
|||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
|
image: git.digifox.live/digifoxkurama/titan-web:latest
|
||||||
restart: always
|
restart: always
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
target: production
|
target: production
|
||||||
expose:
|
expose:
|
||||||
- "80"
|
- "80"
|
||||||
|
ports:
|
||||||
|
- "3000:80"
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
labels:
|
labels:
|
||||||
- "coolify.endpoint=true"
|
- "coolify.endpoint=true"
|
||||||
|
|
||||||
api:
|
api:
|
||||||
|
image: git.digifox.live/digifoxkurama/titan-api:latest
|
||||||
restart: always
|
restart: always
|
||||||
build:
|
build:
|
||||||
context: ./backend
|
context: ./backend
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user