build: don't use context for building Docker image

Use a provided VERSION argument to override the one in the Makefile.
This commit is contained in:
Vincent Bernat
2025-08-04 12:26:27 +02:00
parent 04b9fbde5e
commit 83261a453d
3 changed files with 10 additions and 3 deletions

View File

@@ -238,6 +238,10 @@ jobs:
with:
fetch-depth: 0
persist-credentials: false
- name: Get version
id: version
run: |
echo version=$(make version) >> "$GITHUB_OUTPUT"
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/metadata-action@v5
@@ -256,9 +260,9 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
- name: Build image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: |
linux/amd64
@@ -266,6 +270,8 @@ jobs:
linux/arm64
linux/arm/v7
push: true
build-args: |
VERSION=${{ steps.version.outputs.version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}

View File

@@ -18,6 +18,7 @@ RUN touch console/frontend/node_modules console/data/frontend .fmt-js~ .fmt.go~
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ARG VERSION
RUN make
FROM gcr.io/distroless/static:latest

View File

@@ -4,7 +4,7 @@ RUN echo filter-syscalls = false >> /etc/nix/nix.conf
WORKDIR /app
COPY . .
RUN mkdir -p /output/store
RUN git describe --tags --always --dirty --match=v* > .version && git add -f .version
RUN make version > .version && git add -f .version
RUN nix run ".#update" \
&& nix run ".#build" \
&& cp -va $(nix-store -qR result) /output/store \