修改docker打包脚本

This commit is contained in:
dushixiang 2022-03-08 21:55:46 +08:00
parent aaee5102fd
commit 16f73945c3

View File

@ -9,12 +9,12 @@ WORKDIR /app
COPY . . COPY . .
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk add gcc g++ upx RUN apk add upx
RUN go mod tidy RUN go mod tidy
RUN sh get_arch.sh RUN sh get_arch.sh
RUN echo "Hello, my CPU architecture is $(uname -m)" RUN echo "Hello, my CPU architecture is $(uname -m)"
RUN cp -r /app/web/build /app/server/resource/ RUN cp -r /app/web/build /app/server/resource/
RUN go env;CGO_ENABLED=1 GOOS=linux GOARCH=$ARCH go build -a -ldflags '-linkmode external -extldflags "-static"' -o next-terminal main.go RUN go env;CGO_ENABLED=0 GOOS=linux GOARCH=$ARCH go build -ldflags '-s -w' -o next-terminal main.go
RUN upx next-terminal RUN upx next-terminal
FROM alpine:latest FROM alpine:latest
@ -36,7 +36,6 @@ RUN touch config.yml
COPY --from=builder /app/next-terminal ./ COPY --from=builder /app/next-terminal ./
COPY --from=builder /app/LICENSE ./ COPY --from=builder /app/LICENSE ./
#COPY --from=builder /app/web/build ./web/build
EXPOSE $SERVER_PORT $SSHD_PORT EXPOSE $SERVER_PORT $SSHD_PORT