From aaee5102fd6c4d27265198198c9dcb1ae704dc3f Mon Sep 17 00:00:00 2001 From: dushixiang Date: Sun, 6 Mar 2022 15:43:38 +0800 Subject: [PATCH] =?UTF-8?q?Docker=20=E6=89=93=E5=8C=85=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20upx=20=E5=8E=8B=E7=BC=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4d3bdb1..e2263c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,12 +9,12 @@ WORKDIR /app COPY . . RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories -RUN apk add upx +RUN apk add gcc g++ upx RUN go mod tidy RUN sh get_arch.sh RUN echo "Hello, my CPU architecture is $(uname -m)" RUN cp -r /app/web/build /app/server/resource/ -RUN go env;CGO_ENABLED=0 GOOS=linux GOARCH=$ARCH go build -ldflags '-s -w' -o next-terminal main.go +RUN go env;CGO_ENABLED=1 GOOS=linux GOARCH=$ARCH go build -a -ldflags '-linkmode external -extldflags "-static"' -o next-terminal main.go RUN upx next-terminal FROM alpine:latest @@ -36,6 +36,7 @@ RUN touch config.yml COPY --from=builder /app/next-terminal ./ COPY --from=builder /app/LICENSE ./ +#COPY --from=builder /app/web/build ./web/build EXPOSE $SERVER_PORT $SSHD_PORT