diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml index 5329c40aa..f96c9ac48 100644 --- a/.github/workflows/build-image.yaml +++ b/.github/workflows/build-image.yaml @@ -78,6 +78,8 @@ jobs: file: ${{ inputs.dockerfile }} platforms: ${{ inputs.platform }} tags: ${{ steps.meta.outputs.tags }} + build-args: | + VERSION=${{ steps.meta.outputs.version }} - name: Build and Push uses: docker/build-push-action@v6 @@ -88,6 +90,8 @@ jobs: file: ${{ inputs.dockerfile }} platforms: ${{ inputs.platform }} tags: ${{ steps.meta.outputs.tags }} + build-args: | + VERSION=${{ steps.meta.outputs.version }} - name: Summary env: diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index ca1b7158e..8853beb33 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -57,6 +57,8 @@ USER nodejs EXPOSE 8081 +ARG VERSION=dev +ENV CTRLPLANE_VERSION=$VERSION ENV NODE_ENV=production ENV HOSTNAME=0.0.0.0 ENV AUTH_TRUST_HOST=true diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index 90b7959c5..5121d6197 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -38,6 +38,8 @@ COPY apps/web/package.json ./apps/web/package.json RUN pnpm install --frozen-lockfile COPY . . +ARG VERSION=dev +ENV VITE_CTRLPLANE_VERSION=$VERSION RUN turbo build --filter=...@ctrlplane/web RUN addgroup --system --gid 1001 nodejs diff --git a/apps/workspace-engine/Dockerfile b/apps/workspace-engine/Dockerfile index e04e9d13e..7745e9636 100644 --- a/apps/workspace-engine/Dockerfile +++ b/apps/workspace-engine/Dockerfile @@ -17,9 +17,11 @@ RUN go mod download # Copy rest of source code COPY . . +ARG VERSION=dev + # Build the binary with CGO enabled (required for confluent-kafka-go) # The vendored librdkafka will be statically linked -RUN CGO_ENABLED=1 GOOS=linux go build -o engine . +RUN CGO_ENABLED=1 GOOS=linux go build -ldflags "-X workspace-engine/pkg/version.Version=$VERSION" -o engine . # Final stage - use Debian slim for glibc compatibility FROM debian:bookworm-slim diff --git a/apps/workspace-engine/pkg/version/version.go b/apps/workspace-engine/pkg/version/version.go new file mode 100644 index 000000000..4a07d07ba --- /dev/null +++ b/apps/workspace-engine/pkg/version/version.go @@ -0,0 +1,3 @@ +package version + +var Version = "dev"