Skip to content

Commit

Permalink
Add a BUILD_VERSION arg to the Dockerfile and pass the github.ref whe…
Browse files Browse the repository at this point in the history
…n releasing
  • Loading branch information
alexsporn committed Feb 16, 2024
1 parent b89d5a8 commit 7db703b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Release
on:
release:
types: [published]
workflow_dispatch:

jobs:
docker:
Expand Down Expand Up @@ -43,4 +44,6 @@ jobs:
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
BUILD_VERSION=${{ github.ref }}
tags: ${{ steps.meta.outputs.tags }}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
FROM golang:1.21-bookworm AS build

ARG BUILD_TAGS=rocksdb
ARG BUILD_VERSION=v1.0.0-develop

LABEL org.label-schema.description="IOTA core node"
LABEL org.label-schema.name="iotaledger/iota-core"
Expand All @@ -28,7 +29,7 @@ RUN go mod download
RUN go mod verify

# Build the binary
RUN go build -o /app/iota-core -tags="$BUILD_TAGS" -ldflags='-w -s'
RUN go build -o /app/iota-core -tags="$BUILD_TAGS" -ldflags="-w -s -X=github.com/iotaledger/iota-core/components/app.Version=${BUILD_VERSION}"

# Copy the assets
RUN cp ./config_defaults.json /app/config.json
Expand Down
2 changes: 1 addition & 1 deletion components/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
Name = "iota-core"

// Version of the app.
Version = "1.0.0-alpha.6"
Version = "v1.0.0-develop"
)

func App() *app.App {
Expand Down

0 comments on commit 7db703b

Please sign in to comment.