From a7cc4eb092dd26bd316256237bd5025acff00f9a Mon Sep 17 00:00:00 2001 From: Maksym Kryvchun Date: Wed, 8 Jun 2022 19:35:17 +0300 Subject: [PATCH] provide docker args (#30) --- .github/workflows/check.yml | 2 +- .github/workflows/release.yml | 4 +++- Dockerfile | 5 +++-- Makefile | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 38b9a7f..aa9c48a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: '1.17.8' + go-version: '1.18.3' id: go - name: Check out code into the Go module directory diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9e8643..34d362b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: '1.17.8' + go-version: '1.18.3' - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 @@ -54,3 +54,5 @@ jobs: platforms: linux/amd64,linux/arm/v6,linux/386 push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/gherkingen:latest,${{ secrets.DOCKERHUB_USERNAME }}/gherkingen:${{ steps.vars.outputs.tag }} + build-args: | + APPLICATION_VERSION=${{ steps.vars.outputs.tag }} diff --git a/Dockerfile b/Dockerfile index aade5ec..1a5f1e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG GOLANG_DOCKER_TAG=1.17.8-alpine3.15 +ARG GOLANG_DOCKER_TAG=1.18.3-alpine3.15 ARG ALPINE_DOCKER_TAG=3.15 FROM golang:$GOLANG_DOCKER_TAG as builder @@ -8,7 +8,8 @@ RUN apk update && apk upgrade && apk add --no-cache make WORKDIR /build COPY . . -RUN make build OUT_PATH=/build/bin/gherkingen +ARG APPLICATION_VERSION=unknown +RUN make build OUT_PATH=/build/bin/gherkingen VERSION=$APPLICATION_VERSION FROM alpine:$ALPINE_DOCKER_TAG diff --git a/Makefile b/Makefile index ac2875f..c28f3ee 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ GOLANG_CI_LINT_VER:=v1.45.0 OUT_BIN?=${PWD}/bin/gherkingen COVER_PACKAGES=${shell go list ./... | grep -Ev 'examples|model' | tr '\n' ','} -VERSION=${shell git describe --tags} +VERSION?=${shell git describe --tags} build: @echo "building ${VERSION}"