diff --git a/.dockerignore b/.dockerignore index e4722dc..21934c1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,7 +6,6 @@ bin *.pyc *.egg-info .vagrant -.git .tmp bower_components node_modules diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 045f69f..f2f7ed8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,7 +35,7 @@ jobs: CGO_ENABLED: 0 run: | go version - go build -tags netgo -ldflags '-X github.com/dutchcoders/transfer.sh/cmd.Version=${GITHUB_REF##*/} -a -s -w -extldflags "-static"' -o ./artifacts/transfersh-${GITHUB_REF##*/}-${{ matrix.suffix }} + go build -tags netgo -ldflags "-X github.com/dutchcoders/transfer.sh/cmd.Version=${GITHUB_REF##*/} -a -s -w -extldflags '-static'" -o ./artifacts/transfersh-${GITHUB_REF##*/}-${{ matrix.suffix }} - uses: actions/upload-artifact@v2 name: Upload artifacts with: diff --git a/Dockerfile b/Dockerfile index 99ada23..25d08c1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -# Default to Go 1.15 -ARG GO_VERSION=1.15 +# Default to Go 1.16 +ARG GO_VERSION=1.16 FROM golang:${GO_VERSION}-alpine as build # Necessary to run 'go get' and to compile the linked binary @@ -12,7 +12,7 @@ WORKDIR /go/src/github.com/dutchcoders/transfer.sh ENV GO111MODULE=on # build & install server -RUN go get -u ./... && CGO_ENABLED=0 go build -tags netgo -ldflags '-a -s -w -extldflags "-static"' -o /go/bin/transfersh github.com/dutchcoders/transfer.sh +RUN CGO_ENABLED=0 go build -tags netgo -ldflags "-X github.com/dutchcoders/transfer.sh/cmd.Version=$(git describe --tags) -a -s -w -extldflags '-static'" -o /go/bin/transfersh FROM scratch AS final LABEL maintainer="Andrea Spacca "