From 3699762be397ada0aa4ab738d6c13949e9dc6205 Mon Sep 17 00:00:00 2001 From: Rzy <465386466@qq.com> Date: Tue, 18 Jun 2024 18:33:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8D=A3=E6=95=B0api=E8=BD=AC=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0d58c6a..819ea8e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,14 @@ FROM golang:1.21.10-alpine AS builder LABEL stage=gobuilder -RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories/ + ENV CGO_ENABLED 0 ENV GOPROXY https://goproxy.cn,direct -WORKDIR /src +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories + +RUN apk update --no-cache && apk add --no-cache tzdata + +WORKDIR /msgc COPY ../.. . RUN go mod download @@ -12,16 +16,20 @@ RUN go build -ldflags="-s -w" -o /src/cmd/api/transfer cmd/api/transfer.go FROM alpine:latest AS runtime -RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories/ + +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories + +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai +ENV TZ Asia/Shanghai +COPY --from=builder /src /src RUN apk update --no-cache && apk add --no-cache supervisor RUN apk add --no-cache make -ENV TZ Asia/Shanghai -COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt -COPY --from=builder /src /src + RUN mkdir "/var/log/supervisor" -WORKDIR /src + ADD ./sh/startup.sh /opt/startup.sh RUN sed -i 's/\r//g' /opt/startup.sh ADD ./sh/supervisord.conf /etc/supervisord.conf