Skip to content

Commit

Permalink
* Removed the default from the go code (set it as N/A)
Browse files Browse the repository at this point in the history
* Changed version from latest to dev inside makefile
* Added buildarg for version to the dockerfile in the makerfile
* Added VERSION with default dev value as arg inside dockerfile
* Cleaned up inside dockerfile
  • Loading branch information
ViktorLindgren95 committed Aug 17, 2022
1 parent 3f4999c commit 826bad3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ WORKDIR /workspace

# Make it runnable on a distroless image/without libc
ENV CGO_ENABLED=0
# Enviroment Variable used inside main to display current ARC version
ENV ARC_VERSION=$VERSION
# Copy the Go Modules manifests
COPY go.mod go.sum ./

Expand All @@ -26,7 +24,7 @@ RUN go mod download
# With the above commmand,
# TARGETOS can be "linux", TARGETARCH can be "amd64", "arm64", and "arm", TARGETVARIANT can be "v7".

ARG TARGETPLATFORM TARGETOS TARGETARCH TARGETVARIANT
ARG TARGETPLATFORM TARGETOS TARGETARCH TARGETVARIANT VERSION=dev

# We intentionally avoid `--mount=type=cache,mode=0777,target=/go/pkg/mod` in the `go mod download` and the `go build` runs
# to avoid https://github.com/moby/buildkit/issues/2334
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ else
NAME ?= summerwind/actions-runner-controller
endif
DOCKER_USER ?= $(shell echo ${NAME} | cut -d / -f1)
VERSION ?= latest
VERSION ?= dev
RUNNER_VERSION ?= 2.294.0
TARGETPLATFORM ?= $(shell arch)
RUNNER_NAME ?= ${DOCKER_USER}/actions-runner
Expand Down Expand Up @@ -119,6 +119,7 @@ docker-buildx:
docker buildx build --platform ${PLATFORMS} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
--build-arg VERSION=${VERSION} \
-t "${NAME}:${VERSION}" \
-f Dockerfile \
. ${PUSH_ARG}
Expand Down
2 changes: 1 addition & 1 deletion build/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package build

// This is overridden at build-time using go-build ldflags. dev is the fallback value
var Version = "dev"
var Version = "N/A"

0 comments on commit 826bad3

Please sign in to comment.