Switch to Docker-based deployment with ACR #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Pipeline | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| env: | |
| NODE_VERSION: '20' | |
| jobs: | |
| # Backend CI | |
| backend: | |
| name: Backend CI | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./backend | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: backend/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Start backend (test server starts) | |
| run: | | |
| timeout 10 npm start || true | |
| env: | |
| MONGO_URI: mongodb://localhost:27017/test | |
| JWT_SECRET: test_secret | |
| PORT: 3001 | |
| # Frontend CI | |
| frontend: | |
| name: Frontend CI | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./frontend | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build application | |
| run: npm run build | |
| # Docker Build | |
| docker: | |
| name: Build Docker Images | |
| runs-on: ubuntu-latest | |
| needs: [backend, frontend] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Backend Image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./backend | |
| push: false | |
| tags: flowops-backend:${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build Frontend Image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./frontend | |
| push: false | |
| tags: flowops-frontend:${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |