-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
31 lines (23 loc) · 818 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.21.11 as builder
#ENV GOPROXY=https://goproxy.cn,https://goproxy.io,direct
ENV GO111MODULE=on
ENV GOCACHE=/go/pkg/.cache/go-build
ADD . /app
WORKDIR /app
RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o /app/jd-stock /app/runner.go
FROM alpine:3.6 as alpine
RUN apk update && \
apk add -U --no-cache ca-certificates tzdata
FROM alpine:3.6
MAINTAINER zhuweitung
LABEL maintainer="zhuweitung" \
email="zhuweitung@foxmail.com"
ENV TZ="Asia/Shanghai"
COPY --from=alpine /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /app/jd-stock /app/jd-stock
COPY --from=builder /app/data /app/data
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo $TZ > /etc/timezone
WORKDIR /app
CMD ["./jd-stock"]