-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
45 lines (31 loc) · 996 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM golang:alpine AS builder
LABEL stage=gobuilder
ENV CGO_ENABLED 0
ENV GOOS linux
ENV GO111MODULE on
ENV GOPROXY https://goproxy.cn,direct
WORKDIR /build/app
ADD go.mod .
ADD go.sum .
RUN go env -w GOPROXY=https://goproxy.cn,direct && go mod download
RUN export GO111MODULE=on && \
export GOPROXY=https://goproxy.cn && \
go mod download
COPY . .
RUN go build -ldflags="-s -w" -o /app/apps ./cmd
ADD build/app.yaml /app/
ADD build/service.sh /app/service.sh
COPY resource/ /app/resource
FROM alpine
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk update --no-cache && apk add --no-cache ca-certificates tzdata curl bash tar yarn
ENV TZ Asia/Shanghai
WORKDIR /app
COPY --from=builder /app/apps /app/apps
COPY --from=builder /app/app.yaml /app/app.yaml
COPY --from=builder /app/service.sh /app/service.sh
COPY --from=builder /app/resource /app/resource
RUN chmod +x /app/service.sh
EXPOSE 8080
EXPOSE 8888
CMD ["/app/service.sh"]