From 6275e27d1b0a3e4d8771ccdd9da3be2da3b89a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=AE=E5=87=89?= <927625802@qq.com> Date: Tue, 9 Nov 2021 17:54:38 +0800 Subject: [PATCH] :green_heart: fix dockerfile --- Dockerfile | 5 +++-- build.sh | 10 ++-------- 2 files changed, 5 insertions(+), 10 deletions(-) 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"