Skip to content

Commit

Permalink
💚 fix dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Nov 9, 2021
1 parent e703537 commit 6275e27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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="[email protected]"
Expand Down
10 changes: 2 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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' \
Expand Down Expand Up @@ -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"

Expand Down

0 comments on commit 6275e27

Please sign in to comment.