diff --git a/Dockerfile b/Dockerfile index 8d5cf30e..eaba2ed5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ -FROM golang:alpine as builder +FROM alpine as builder LABEL stage=go-builder WORKDIR /app/ COPY ./ ./ -RUN sh build.sh docker +RUN apk add --no-cache bash git go=1.17.3-r0 gcc musl-dev; \ + sh build.sh docker FROM alpine LABEL MAINTAINER="i@nn.ci" diff --git a/build.sh b/build.sh index 6267932c..763681f4 100644 --- a/build.sh +++ b/build.sh @@ -10,13 +10,12 @@ if [ "$1" == "web" ]; then fi if [ "$1" == "docker" ]; then - apk add --no-cache git appName="alist" builtAt="$(date +'%F %T %z')" goVersion=$(go version | sed 's/go version //') gitAuthor=$(git show -s --format='format:%aN <%ae>' HEAD) gitCommit=$(git log --pretty=format:"%h" -1) - gitTag=$(git describe --abbrev=0 --tags) + gitTag=$(git describe --long --tags --dirty --always) ldflags="\ -w -s \ -X 'github.com/Xhofe/alist/conf.BuiltAt=$builtAt' \ @@ -47,12 +46,7 @@ builtAt="$(date +'%F %T %z')" goVersion=$(go version | sed 's/go version //') gitAuthor=$(git show -s --format='format:%aN <%ae>' HEAD) gitCommit=$(git log --pretty=format:"%h" -1) - -if [ "$1" == "release" ]; then - gitTag=$(git describe --abbrev=0 --tags) -else - gitTag=build-next -fi +gitTag=$(git describe --long --tags --dirty --always) echo "build version: $gitTag"