-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
44 lines (30 loc) · 927 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 node:18-alpine as webbuilder
COPY . /forest
RUN cd /forest/web \
&& npm i \
&& npm run build \
&& rm -rf node_module
FROM golang:1.20-alpine as builder
COPY --from=webbuilder /forest /forest
RUN apk update \
&& apk add git make curl jq \
&& cd /forest \
&& rm -rf asset/dist \
&& cp -rf web/dist asset/ \
&& make install \
&& make generate \
&& ./download-swagger.sh \
&& make build
FROM alpine
EXPOSE 7001
# tzdata 安装所有时区配置或可根据需要只添加所需时区
RUN addgroup -g 1000 go \
&& adduser -u 1000 -G go -s /bin/sh -D go \
&& apk add --no-cache ca-certificates tzdata
COPY --from=builder /forest/forest /usr/local/bin/forest
COPY --from=builder /forest/entrypoint.sh /entrypoint.sh
USER go
WORKDIR /home/go
HEALTHCHECK --timeout=10s --interval=10s CMD [ "wget", "http://127.0.0.1:7001/ping", "-q", "-O", "-"]
CMD ["forest"]
ENTRYPOINT ["/entrypoint.sh"]