-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
42 lines (38 loc) · 1 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
#FROM golang:1.16
#ENV GOPROXY="https://goproxy.cn" \
# CGO_ENABLED=1 \
# GOOS=linux \
# GOARCH=amd64 \
# GO111MODULE=on \
# CONFIG="prod"
#
#WORKDIR /
#COPY ./src /src
#COPY ./config /config
#RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
#WORKDIR /src
#RUN go build .
#EXPOSE 3456
#ENTRYPOINT ["./bug-carrot"]
FROM golang:1.16-alpine3.15 as builder
ENV GOPROXY="https://goproxy.cn" \
CGO_ENABLED=1 \
GOOS=linux \
GOARCH=amd64 \
GO111MODULE=on
RUN apk add build-base
WORKDIR /
COPY ./src /src
WORKDIR /src
RUN go build -o /build/app .
FROM alpine:3.15
ENV CONFIG="prod"
RUN apk --no-cache add -U tzdata ca-certificates libc6-compat libgcc libstdc++ && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > "/etc/timezone"
COPY --from=builder /build/app /usr/bin/app
COPY --from=builder /go/pkg/mod/github.com/ttys3 /go/pkg/mod/github.com/ttys3
COPY ./config /config
WORKDIR /
EXPOSE 3456
ENTRYPOINT [ "app" ]