JM-WechatMini/Dockerfile
2024-03-31 04:25:09 +08:00

29 lines
777 B
Docker

FROM golang:alpine as builder
WORKDIR /go/src/miniapp
COPY . .
RUN go env -w GO111MODULE=on \
&& go env -w GOPROXY=https://goproxy.cn,direct \
&& go env -w CGO_ENABLED=0 \
&& go env \
&& go mod tidy \
&& go build -o server .
FROM alpine:latest
WORKDIR /go/src/miniapp
COPY --from=0 /go/src/miniapp/server ./
COPY --from=0 /go/src/miniapp/resource ./resource/
COPY --from=0 /go/src/miniapp/docker/config.docker.yaml ./docker/
COPY --from=0 /go/src/miniapp/docker ./
# 添加时区环境变量,亚洲,上海
ENV TimeZone=Asia/Shanghai
# 使用软连接,并且将时区配置覆盖/etc/timezone
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
EXPOSE 8888
ENTRYPOINT ./server -c docker/config.docker.yaml