Skip to content

Commit

Permalink
embed version in image
Browse files Browse the repository at this point in the history
  • Loading branch information
raylas committed Nov 28, 2022
1 parent bffbbd5 commit 63d6534
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,5 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ steps.context.outputs.tag }}
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
FROM golang:1.19.3-alpine3.16 AS build
WORKDIR /src
COPY . /src
RUN CGO_ENABLED=0 GOOS=linux go build -o nextdns-exporter
ARG VERSION
RUN CGO_ENABLED=0 \
GOOS=linux \
go build -ldflags="-s -w -X 'main.version=$VERSION'" \
-o nextdns-exporter

FROM alpine:3.16 AS src
COPY --from=build /src/nextdns-exporter .
Expand Down

0 comments on commit 63d6534

Please sign in to comment.