Skip to content

Commit e308cef

Browse files
chore: bake build version into container images (#1145)
1 parent ea27815 commit e308cef

5 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎.github/workflows/build-image.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ jobs:
7878
file: ${{ inputs.dockerfile }}
7979
platforms: ${{ inputs.platform }}
8080
tags: ${{ steps.meta.outputs.tags }}
81+
build-args: |
82+
VERSION=${{ steps.meta.outputs.version }}
8183
8284
- name: Build and Push
8385
uses: docker/build-push-action@v6
@@ -88,6 +90,8 @@ jobs:
8890
file: ${{ inputs.dockerfile }}
8991
platforms: ${{ inputs.platform }}
9092
tags: ${{ steps.meta.outputs.tags }}
93+
build-args: |
94+
VERSION=${{ steps.meta.outputs.version }}
9195
9296
- name: Summary
9397
env:

‎apps/api/Dockerfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ USER nodejs
5757

5858
EXPOSE 8081
5959

60+
ARG VERSION=dev
61+
ENV CTRLPLANE_VERSION=$VERSION
6062
ENV NODE_ENV=production
6163
ENV HOSTNAME=0.0.0.0
6264
ENV AUTH_TRUST_HOST=true

‎apps/web/Dockerfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ COPY apps/web/package.json ./apps/web/package.json
3838
RUN pnpm install --frozen-lockfile
3939
COPY . .
4040

41+
ARG VERSION=dev
42+
ENV VITE_CTRLPLANE_VERSION=$VERSION
4143
RUN turbo build --filter=...@ctrlplane/web
4244

4345
RUN addgroup --system --gid 1001 nodejs

‎apps/workspace-engine/Dockerfile‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ RUN go mod download
1717
# Copy rest of source code
1818
COPY . .
1919

20+
ARG VERSION=dev
21+
2022
# Build the binary with CGO enabled (required for confluent-kafka-go)
2123
# The vendored librdkafka will be statically linked
22-
RUN CGO_ENABLED=1 GOOS=linux go build -o engine .
24+
RUN CGO_ENABLED=1 GOOS=linux go build -ldflags "-X workspace-engine/pkg/version.Version=$VERSION" -o engine .
2325

2426
# Final stage - use Debian slim for glibc compatibility
2527
FROM debian:bookworm-slim
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package version
2+
3+
var Version = "dev"

0 commit comments

Comments
 (0)