💚 fix dockerfile

pull/548/head
微凉 2021-11-09 17:54:38 +08:00
parent e70353704f
commit 6275e27d1b
2 changed files with 5 additions and 10 deletions

View File

@ -1,8 +1,9 @@
FROM golang:alpine as builder FROM alpine as builder
LABEL stage=go-builder LABEL stage=go-builder
WORKDIR /app/ WORKDIR /app/
COPY ./ ./ 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 FROM alpine
LABEL MAINTAINER="i@nn.ci" LABEL MAINTAINER="i@nn.ci"

View File

@ -10,13 +10,12 @@ if [ "$1" == "web" ]; then
fi fi
if [ "$1" == "docker" ]; then if [ "$1" == "docker" ]; then
apk add --no-cache git
appName="alist" appName="alist"
builtAt="$(date +'%F %T %z')" builtAt="$(date +'%F %T %z')"
goVersion=$(go version | sed 's/go version //') goVersion=$(go version | sed 's/go version //')
gitAuthor=$(git show -s --format='format:%aN <%ae>' HEAD) gitAuthor=$(git show -s --format='format:%aN <%ae>' HEAD)
gitCommit=$(git log --pretty=format:"%h" -1) gitCommit=$(git log --pretty=format:"%h" -1)
gitTag=$(git describe --abbrev=0 --tags) gitTag=$(git describe --long --tags --dirty --always)
ldflags="\ ldflags="\
-w -s \ -w -s \
-X 'github.com/Xhofe/alist/conf.BuiltAt=$builtAt' \ -X 'github.com/Xhofe/alist/conf.BuiltAt=$builtAt' \
@ -47,12 +46,7 @@ builtAt="$(date +'%F %T %z')"
goVersion=$(go version | sed 's/go version //') goVersion=$(go version | sed 's/go version //')
gitAuthor=$(git show -s --format='format:%aN <%ae>' HEAD) gitAuthor=$(git show -s --format='format:%aN <%ae>' HEAD)
gitCommit=$(git log --pretty=format:"%h" -1) gitCommit=$(git log --pretty=format:"%h" -1)
gitTag=$(git describe --long --tags --dirty --always)
if [ "$1" == "release" ]; then
gitTag=$(git describe --abbrev=0 --tags)
else
gitTag=build-next
fi
echo "build version: $gitTag" echo "build version: $gitTag"