From fe683a6534ac049cf274785d00ec9588a1cf1f7e Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 25 Feb 2022 23:48:58 +0100 Subject: [PATCH] [GH-241] Resolve 'version not shown when running docker'. --- .dockerignore | 1 + .github/workflows/docker.yml | 4 +++- Dockerfile | 5 +++-- README.md | 6 +++--- build/package/snap/snapcraft.yaml | 2 +- docs/CHANGELOG.md | 21 ++++++++++++++------- 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.dockerignore b/.dockerignore index 9daeafb9..ebf18597 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,2 @@ test +virtualbox* diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 70d0ba2b..bdfbd79f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,7 +3,7 @@ name: Docker on: push: tags: - - "*" + - '*' jobs: release: runs-on: ubuntu-latest @@ -26,5 +26,7 @@ jobs: with: push: true tags: utrecht/n3dr:${{ steps.version.outputs.version }} + build-args: | + VERSION=${GITHUB_REF} - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/Dockerfile b/Dockerfile index 7bc0b02b..a047adb1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ -FROM golang:1.17.6-alpine3.15 as builder +FROM golang:1.17.7-alpine3.15 as builder +ARG VERSION ENV USERNAME n3dr RUN adduser -D -g '' $USERNAME COPY . /go/${USERNAME}/ WORKDIR /go/${USERNAME}/cmd/${USERNAME} RUN apk add --no-cache git=~2 && \ - CGO_ENABLED=0 go build && \ + CGO_ENABLED=0 go build -ldflags "-X main.Version=${VERSION}" && \ cp n3dr /n3dr FROM alpine:3.15.0 diff --git a/README.md b/README.md index d636516c..33677d46 100644 --- a/README.md +++ b/README.md @@ -315,7 +315,7 @@ n3dr config \ ### Build ```bash -docker build -t utrecht/n3dr:6.5.0 . +docker build -t utrecht/n3dr:6.5.1 . ``` [![dockeri.co](https://dockeri.co/image/utrecht/n3dr)](https://hub.docker.com/r/utrecht/n3dr) @@ -325,7 +325,7 @@ docker build -t utrecht/n3dr:6.5.0 . ```bash docker run -it \ -v /home/${USER}/.n3dr:/root/.n3dr \ - -v /tmp/n3dr:/tmp/n3dr utrecht/n3dr:6.5.0 + -v /tmp/n3dr:/tmp/n3dr utrecht/n3dr:6.5.1 ``` ### Upload @@ -334,7 +334,7 @@ docker run -it \ docker run -it \ --entrypoint=/bin/ash \ -v /home/${USER}/.n3dr:/root/.n3dr \ - -v /tmp/n3dr:/tmp/n3dr utrecht/n3dr:6.5.0 + -v /tmp/n3dr:/tmp/n3dr utrecht/n3dr:6.5.1 ``` navigate to the repository folder, e.g. `/tmp/n3dr/download*/` and upload: diff --git a/build/package/snap/snapcraft.yaml b/build/package/snap/snapcraft.yaml index 0845f2a9..e86e91c0 100644 --- a/build/package/snap/snapcraft.yaml +++ b/build/package/snap/snapcraft.yaml @@ -1,7 +1,7 @@ --- name: n3dr base: core20 -version: 6.5.0 +version: 6.5.1 summary: Nexus3 Disaster Recovery description: | Download all artifacts at once or migrate automatically from Nexus to Nexus. diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5a1c6cdb..3705bb10 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [6.5.0] - 2021-01-16 +## [6.5.1] - 2022-02-26 + +### Fixed + +- version omitted when docker --version is run. + +## [6.5.0] - 2022-01-16 ### Added @@ -29,7 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - some duplicated code by using `FilesToBeSkipped` and `PrintType` functions. -## [6.4.3] - 2021-01-10 +## [6.4.3] - 2022-01-10 ### Added @@ -49,7 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - integration tests from unit testing. -## [6.4.2] - 2021-01-03 +## [6.4.2] - 2022-01-03 ### Fixed @@ -57,14 +63,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 `~/.n3dr/config.yml` reported by [der-eismann](https://github.com/der-eismann). -## [6.4.1] - 2021-01-03 +## [6.4.1] - 2022-01-03 ### Changed - Use Go embed for logo and change path for logo file by [der-eismann](https://github.com/der-eismann). -## [6.4.0] - 2021-01-02 +## [6.4.0] - 2022-01-02 ### Added @@ -596,7 +602,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- URL in repositories subcommand always set to http://localhost:9999. +- URL in repositories subcommand always set to . ## [2.1.0] - 2019-05-19 @@ -654,7 +660,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Download all artifacts from a certain Nexus3 repository. -[Unreleased]: https://github.com/030/n3dr/compare/6.5.0...HEAD +[Unreleased]: https://github.com/030/n3dr/compare/6.5.1...HEAD +[6.5.1]: https://github.com/030/n3dr/compare/6.5.0...6.5.1 [6.5.0]: https://github.com/030/n3dr/compare/6.4.3...6.5.0 [6.4.3]: https://github.com/030/n3dr/compare/6.4.2...6.4.3 [6.4.2]: https://github.com/030/n3dr/compare/6.4.1...6.4.2