Skip to content

Commit d45dac9

Browse files
committed
Add BUILDTIME build argument to Dockerfile and update build workflow to include metadata-based build arguments
1 parent 9f4c629 commit d45dac9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ jobs:
6363
tags: ${{ steps.meta.outputs.tags }}
6464
labels: ${{ steps.meta.outputs.labels }}
6565
build-args: |
66-
COMMIT_HASH=${{ github.sha }}
66+
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
67+
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
68+
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
69+
6770
6871
- name: Extract file from pushed image
6972
if: github.ref_type == 'tag'

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ COPY . .
2525

2626
# target parameters for cross-compilation
2727
ARG TARGETOS
28-
ARG TARGETARCH
28+
29+
ARG BUILDTIME=""
2930
ARG VERSION="dev"
3031
ARG REVISION="000000000000000000000000000000"
3132

0 commit comments

Comments
 (0)