generated from wujunyi792/flamego-quick-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
30 lines (21 loc) · 742 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
FROM golang:1.16-alpine AS builder
RUN go env -w GO111MODULE=auto \
&& go env -w CGO_ENABLED=0 \
&& go env -w GOPROXY=https://goproxy.cn,direct
WORKDIR /build
COPY . .
RUN set -ex \
&& cd /build \
&& pwd \
&& ls \
&& go build -ldflags "-s -w -extldflags '-static'" -o App ./cmd/main.go
FROM alpine:latest
WORKDIR /Serve
COPY ./ ./
COPY --from=builder /build/App ./App
RUN echo 'http://mirrors.ustc.edu.cn/alpine/v3.5/main' > /etc/apk/repositories \
&& echo 'http://mirrors.ustc.edu.cn/alpine/v3.5/community' >>/etc/apk/repositories \
&& apk update && apk add tzdata \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone
ENTRYPOINT [ "/Serve/App" ]