2020-11-27 09:28:40 +00:00
|
|
|
FROM golang:1.15-alpine as builder
|
2018-05-18 14:20:41 +00:00
|
|
|
|
2020-11-27 09:28:40 +00:00
|
|
|
RUN apk update \
|
|
|
|
&& apk add --no-cache git ca-certificates make bash yarn nodejs
|
2018-05-18 14:20:41 +00:00
|
|
|
|
2020-11-27 09:28:40 +00:00
|
|
|
RUN go env -w GO111MODULE=on && \
|
|
|
|
go env -w GOPROXY=https://goproxy.cn,direct
|
2018-05-18 14:20:41 +00:00
|
|
|
|
2020-11-27 09:28:40 +00:00
|
|
|
WORKDIR /app
|
2018-05-18 14:20:41 +00:00
|
|
|
|
2020-11-27 09:28:40 +00:00
|
|
|
RUN git clone https://github.com/ouqiang/gocron.git \
|
|
|
|
&& cd gocron \
|
|
|
|
&& yarn config set ignore-engines true \
|
|
|
|
&& make install-vue \
|
2018-05-18 14:20:41 +00:00
|
|
|
&& make build-vue \
|
|
|
|
&& make statik \
|
|
|
|
&& CGO_ENABLED=0 make gocron
|
|
|
|
|
2020-11-27 10:30:17 +00:00
|
|
|
FROM alpine:3.12
|
2018-05-18 14:20:41 +00:00
|
|
|
|
2018-07-08 14:43:31 +00:00
|
|
|
RUN apk add --no-cache ca-certificates tzdata \
|
2018-05-20 07:24:31 +00:00
|
|
|
&& addgroup -S app \
|
2018-05-18 14:20:41 +00:00
|
|
|
&& adduser -S -g app app
|
|
|
|
|
2018-07-08 14:43:31 +00:00
|
|
|
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
|
|
|
|
2018-05-18 14:20:41 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
2020-11-27 09:28:40 +00:00
|
|
|
COPY --from=builder /app/gocron/bin/gocron .
|
2018-05-18 14:20:41 +00:00
|
|
|
|
|
|
|
RUN chown -R app:app ./
|
|
|
|
|
|
|
|
EXPOSE 5920
|
|
|
|
|
|
|
|
USER app
|
|
|
|
|
2018-05-20 07:24:31 +00:00
|
|
|
ENTRYPOINT ["/app/gocron", "web"]
|