From 952913b160f4373c545ffba5c711ca2e1345d9fc Mon Sep 17 00:00:00 2001 From: omegion Date: Sat, 22 May 2021 10:57:19 +0200 Subject: [PATCH] Fix docker container version issue --- .github/workflows/build.yml | 2 ++ Dockerfile | 4 +++- Makefile | 7 ++++++- README.md | 6 ++++++ go.mod | 4 ++-- go.sum | 8 ++++---- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4a7f911..4f29d29 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,6 +41,8 @@ jobs: file: ./Dockerfile push: true tags: ghcr.io/omegion/ssh-manager:${{ steps.get_version.outputs.VERSION }} + build-args: | + VERSION=${{ steps.get_version.outputs.VERSION }} - name: Build Changelog id: github_release diff --git a/Dockerfile b/Dockerfile index 35ae4c1..a78f776 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,8 @@ ARG FROM_IMAGE=alpine:3.12 FROM golang:${GO_VERSION} AS builder +ARG VERSION + LABEL org.opencontainers.image.source="https://github.com/omegion/ssh-manager" WORKDIR /app @@ -15,7 +17,7 @@ RUN apk update && \ rm -rf /var/cache/apk/* && \ rm -rf /var/tmp/* -RUN make build-for-container +RUN make build-for-container VERSION=$VERSION FROM ${FROM_IMAGE} diff --git a/Makefile b/Makefile index 4cc897e..c94ffc7 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,12 @@ export PATH := $(abspath ./vendor/bin):$(PATH) +ifndef VERSION + GIT_VERSION = $(shell git describe --tags --always 2> /dev/null || echo 0.0.0) +else + GIT_VERSION = $(VERSION) +endif + BASE_PACKAGE_NAME = github.com/omegion/ssh-manager -GIT_VERSION = $(shell git describe --tags --always 2> /dev/null || echo 0.0.0) LDFLAGS = -ldflags "-X $(BASE_PACKAGE_NAME)/pkg/info.Version=$(GIT_VERSION)" BUFFER := $(shell mktemp) REPORT_DIR = dist/report diff --git a/README.md b/README.md index 36d40ad..9c931a6 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,12 @@ Use "ssh-manager [command] --help" for more information about a command. ``` +## Installation + +```shell +go get -u github.com/omegion/ssh-manager +``` + ## Requirements * Have the [Bitwarden CLI tool](https://github.com/bitwarden/cli) installed and available in the `$PATH` as `bw`. diff --git a/go.mod b/go.mod index bcfc5f7..35f6448 100644 --- a/go.mod +++ b/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/kr/text v0.2.0 // indirect github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect - github.com/sirupsen/logrus v1.7.0 + github.com/sirupsen/logrus v1.8.1 github.com/spf13/cobra v1.1.3 github.com/stretchr/testify v1.7.0 - golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/sys v0.0.0-20210521203332-0cec03c779c1 // indirect gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect k8s.io/utils v0.0.0-20210521133846-da695404a2bc ) diff --git a/go.sum b/go.sum index 9fbd0e8..fc271c8 100644 --- a/go.sum +++ b/go.sum @@ -149,8 +149,8 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -239,8 +239,8 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210521203332-0cec03c779c1 h1:lCnv+lfrU9FRPGf8NeRuWAAPjNnema5WtBinMgs1fD8= +golang.org/x/sys v0.0.0-20210521203332-0cec03c779c1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=