JM-WechatMini/Dockerfile

29 lines
777 B
Docker
Raw Normal View History

2024-03-31 04:15:39 +08:00
FROM golang:alpine as builder
2023-11-02 04:34:46 +08:00
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 \
2024-01-11 16:03:51 +08:00
&& go build -o server .
2023-11-02 04:34:46 +08:00
2024-03-31 04:18:37 +08:00
FROM alpine:latest
2023-11-02 04:34:46 +08:00
WORKDIR /go/src/miniapp
COPY --from=0 /go/src/miniapp/server ./
COPY --from=0 /go/src/miniapp/resource ./resource/
2024-03-21 21:08:45 +08:00
COPY --from=0 /go/src/miniapp/docker/config.docker.yaml ./docker/
COPY --from=0 /go/src/miniapp/docker ./
2023-11-02 04:34:46 +08:00
2024-03-31 04:25:09 +08:00
# 添加时区环境变量,亚洲,上海
ENV TimeZone=Asia/Shanghai
# 使用软连接,并且将时区配置覆盖/etc/timezone
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
2024-03-31 04:10:36 +08:00
2023-11-02 04:34:46 +08:00
EXPOSE 8888
2024-03-21 21:08:45 +08:00
ENTRYPOINT ./server -c docker/config.docker.yaml