Skip to content

Commit

Permalink
refs #23 Define version build-arg and pass it during docker image build
Browse files Browse the repository at this point in the history
  • Loading branch information
elboletaire committed Jan 5, 2024
1 parent 8496abf commit 1ca1dba
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
CI_COMMIT_REF_NAME=${{ env.tag }}
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ FROM golang:latest as builder

LABEL maintainer="脪scar Casajuana <elboletaire@underave.net>"

ARG CI_COMMIT_REF_NAME
ENV CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME:-latest}

WORKDIR /app

COPY go.mod go.sum ./
Expand Down
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ func init() {
rootCmd.Flags().Uint8VarP(&settings.MaxConcurrency.Pages, "concurrency-pages", "C", 10, "number of concurrent page downloads, hard-limited to 10")
rootCmd.Flags().StringVarP(&settings.Language, "language", "l", "", "only download the specified language")
rootCmd.Flags().StringVarP(&settings.FilenameTemplate, "filename-template", "t", packer.FilenameTemplateDefault, "template for the resulting filename")
rootCmd.Flags().StringVarP(&settings.OutputDir, "output-dir", "o", "./", "output directory for the downloaded files")
// set as persistent, so version command does not complain about the -o flag set via docker
rootCmd.PersistentFlags().StringVarP(&settings.OutputDir, "output-dir", "o", "./", "output directory for the downloaded files")
}

func cerr(err error, prefix string) {
Expand Down

0 comments on commit 1ca1dba

Please sign in to comment.