-
-
Notifications
You must be signed in to change notification settings - Fork 619
feat: add version tags to Docker images #3060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ jobs: | |
| run: | | ||
| docker build \ | ||
| -t ghcr.io/bluewave-labs/checkmate-client:latest \ | ||
| -t ghcr.io/bluewave-labs/checkmate-client:${{ env.VERSION }} \ | ||
| -f ./docker/dist/client.Dockerfile \ | ||
| --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ | ||
| --build-arg VITE_APP_VERSION=${{ env.VERSION }} \ | ||
|
|
@@ -35,13 +36,16 @@ jobs: | |
| - name: Push Client Docker image | ||
| run: | | ||
| docker push ghcr.io/bluewave-labs/checkmate-client:latest | ||
| docker push ghcr.io/bluewave-labs/checkmate-client:${{ env.VERSION }} | ||
|
|
||
| docker-build-and-push-server: | ||
| needs: docker-build-and-push-client | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
|
|
@@ -50,29 +54,31 @@ jobs: | |
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Build Server Docker image | ||
| run: | | ||
| docker build \ | ||
| -t ghcr.io/bluewave-labs/checkmate-backend:latest \ | ||
| -f ./docker/dist/server.Dockerfile \ | ||
| --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ | ||
| . | ||
| - name: Get version | ||
| id: vars | ||
| run: echo "VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | ||
|
|
||
| Remove `--build-arg VITE_APP_VERSION` from server image builds unless server code actually consumes this variable. | ||
|
|
||
| - name: Push Server Docker image | ||
| run: | | ||
| docker push ghcr.io/bluewave-labs/checkmate-backend:latest | ||
| docker push ghcr.io/bluewave-labs/checkmate-backend:${{ env.VERSION }} | ||
|
Comment on lines
61
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2 | Confidence: Medium Speculative: The version tagging implementation lacks validation that versioned images are functionally equivalent to Code Suggestion: Add a smoke test step that deploys and validates the versioned image in an isolated environment before promoting it.Evidence: path:docker/prod/docker-compose.yaml, path:docker/staging/docker-compose.yaml |
||
|
|
||
| - name: Build Mongo Docker image | ||
| run: | | ||
| docker build \ | ||
| -t ghcr.io/bluewave-labs/checkmate-mongo:latest \ | ||
| -t ghcr.io/bluewave-labs/checkmate-mongo:${{ env.VERSION }} \ | ||
| -f ./docker/dist/mongoDB.Dockerfile \ | ||
| --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ | ||
| --build-arg VITE_APP_VERSION=${{ env.VERSION }} \ | ||
| . | ||
|
|
||
| - name: Push MongoDB Docker image | ||
| run: | | ||
| docker push ghcr.io/bluewave-labs/checkmate-mongo:latest | ||
| docker push ghcr.io/bluewave-labs/checkmate-mongo:${{ env.VERSION }} | ||
|
|
||
| docker-build-and-push-server-mono-multiarch: | ||
| runs-on: ubuntu-latest | ||
|
|
@@ -104,6 +110,7 @@ jobs: | |
| push: true | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Contextual Comment] P2 | Confidence: High The multi-arch image naming ( |
||
| tags: | | ||
| ghcr.io/bluewave-labs/checkmate-backend-mono-multiarch:latest | ||
| ghcr.io/bluewave-labs/checkmate-backend-mono-multiarch:${{ env.VERSION }} | ||
| platforms: linux/amd64,linux/arm64 | ||
| labels: | | ||
| org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate | ||
|
|
@@ -133,10 +140,13 @@ jobs: | |
| run: | | ||
| docker build \ | ||
| -t ghcr.io/bluewave-labs/checkmate-backend-mono:latest \ | ||
| -t ghcr.io/bluewave-labs/checkmate-backend-mono:${{ env.VERSION }} \ | ||
| -f ./docker/dist-mono/server.Dockerfile \ | ||
| --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ | ||
| --build-arg VITE_APP_VERSION=${{ env.VERSION }} \ | ||
| . | ||
|
|
||
| - name: Push Server Docker image | ||
| run: docker push ghcr.io/bluewave-labs/checkmate-backend-mono:latest | ||
| run: | | ||
| docker push ghcr.io/bluewave-labs/checkmate-backend-mono:latest | ||
| docker push ghcr.io/bluewave-labs/checkmate-backend-mono:${{ env.VERSION }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| # --------------------- | ||
| FROM node:24-slim AS frontend-build | ||
|
|
||
| ARG VITE_APP_VERSION | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainARG VITE_APP_VERSION is declared but never used. The build argument is not passed to the frontend build process. To propagate the version to the npm build, convert the ARG to an environment variable before the npm run build command: ARG VITE_APP_VERSION
WORKDIR /app/client
COPY client/package.json ./
RUN npm install
RUN npm install [email protected] --build-from-source
COPY client ./
+ENV VITE_APP_VERSION=$VITE_APP_VERSION
RUN npm run buildI'll verify the review comment by examining the Dockerfile and checking how VITE_APP_VERSION is actually used. Length of output: 769 🏁 Script executed: #!/bin/bash
# Search for all references to VITE_APP_VERSION in the Dockerfile
rg -n "VITE_APP_VERSION" docker/dist-arm/server.DockerfileLength of output: 22 🏁 Script executed: #!/bin/bash
# Check if there's a vite config or build script that references this variable
fd -e "vite.config" -e "vite.config.js" -e "vite.config.ts" -e ".env" -e "package.json" client/ 2>/dev/null | head -20Length of output: 0 Length of output: 56 🏁 Script executed: #!/bin/bash
# Find and read client package.json to see build script
find client -name "package.json" -type f -exec cat {} \;Length of output: 1720 🏁 Script executed: #!/bin/bash
# Search for any references to VITE_APP_VERSION throughout the client directory
rg -r "VITE_APP_VERSION" client/Length of output: 60430 🏁 Script executed: #!/bin/bash
# Check for environment variable patterns in the build or client setup
rg -n "process.env" client/ --type=ts --type=js | head -20Length of output: 0 Length of output: 617 🏁 Script executed: #!/bin/bash
# Search for VITE_ prefix usage in client source code to understand Vite env pattern
rg "import\.meta\.env" client/src --type=ts --type=js -C 2Length of output: 1637 ARG VITE_APP_VERSION is declared but never used. The build argument is not passed to the frontend build process. Docker's ARG is only available during build time; it must be converted to an environment variable to be accessible to npm. To propagate the version to the npm build, add an ENV directive before npm run build: ARG VITE_APP_VERSION
WORKDIR /app/client
COPY client/package.json ./
RUN npm install
RUN npm install [email protected] --build-from-source
COPY client ./
+ENV VITE_APP_VERSION=$VITE_APP_VERSION
RUN npm run build
🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
| WORKDIR /app/client | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| FROM node:20-slim AS frontend-build | ||
|
|
||
| ARG VITE_APP_VERSION | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ARG in frontend-build stage not propagated to npm build. The version argument must be converted to an environment variable before the npm build runs: ARG VITE_APP_VERSION
WORKDIR /app/client
COPY client/package*.json ./
RUN npm install
COPY client ./
+ENV VITE_APP_VERSION=$VITE_APP_VERSION
RUN npm run build
🤖 Prompt for AI Agents |
||
|
|
||
| WORKDIR /app/client | ||
|
|
||
| COPY client/package*.json ./ | ||
|
|
@@ -10,6 +12,8 @@ RUN npm run build | |
|
|
||
| FROM node:20-slim AS app | ||
|
|
||
| ARG VITE_APP_VERSION | ||
|
|
||
| # Install ping | ||
| RUN apt-get update \ | ||
| && apt-get install -y iputils-ping \ | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,7 @@ | ||||||
| FROM node:20-slim | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2 | Confidence: High The Dockerfile declares
Suggested change
|
||||||
|
|
||||||
| ARG VITE_APP_VERSION | ||||||
|
|
||||||
| # Install ping | ||||||
| RUN apt-get update \ | ||||||
| && apt-get install -y iputils-ping \ | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2 | Confidence: Medium
The version extraction uses
git describe --tags --abbrev=0which fetches the latest tag. This approach may not work correctly in shallow clones or when building from non-tagged commits. Therelated_contextshows other workflows use similar version extraction, suggesting this pattern is established but potentially fragile across different CI scenarios.Code Suggestion: