chore(docker): use prebuilt image for expressjs service from GHCR #11
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: BrainBytes CI | |
| on: | |
| push: | |
| branches: [master, develop] | |
| paths-ignore: | |
| - "**.md" | |
| - "docs/**" | |
| pull_request: | |
| branches: [master, develop] | |
| paths-ignore: | |
| - "**.md" | |
| - "docs/**" | |
| workflow_dispatch: | |
| jobs: | |
| lint: | |
| name: Check Code Quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm and Node.js | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: "10.10.0" | |
| node-version: "24.1.0" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| working-directory: ./src | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Lint source code | |
| working-directory: ./src | |
| run: pnpm lint | |
| test: | |
| name: Run Tests | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| environment: GitHub actions | |
| env: | |
| JWT_SECRET: ${{secrets.JWT_SECRET}} | |
| MONGO_URI_DOCKER: ${{secrets.MONGO_URI_DOCKER}} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm and Node.js | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: "10.10.0" | |
| node-version: "24.1.0" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| working-directory: ./src | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Run backend tests | |
| working-directory: ./src | |
| run: pnpm test | |
| build: | |
| name: Build Docker Image | |
| needs: ["lint", "test"] | |
| runs-on: ubuntu-latest | |
| environment: GitHub actions | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GHCR_PAT }} | |
| - name: Build and push Image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| file: ./Dockerfile.prod | |
| push: true | |
| tags: ghcr.io/${{ github.repository_owner }}/brainbytes-api:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |