-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
42 lines (27 loc) · 959 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
FROM node:18-alpine as webbuilder
COPY . /diving-rs
RUN apk update \
&& apk add git make \
&& cd /diving-rs \
&& make build-web
FROM rust:alpine as builder
COPY --from=webbuilder /diving-rs /diving-rs
RUN apk update \
&& apk add git make build-base pkgconfig
RUN rustup target list --installed
RUN cd /diving-rs \
&& make release
FROM alpine
EXPOSE 7001
# tzdata 安装所有时区配置或可根据需要只添加所需时区
RUN addgroup -g 1000 rust \
&& adduser -u 1000 -G rust -s /bin/sh -D rust \
&& apk add --no-cache ca-certificates tzdata
COPY --from=builder /diving-rs/target/release/diving /usr/local/bin/diving
COPY --from=builder /diving-rs/entrypoint.sh /entrypoint.sh
ENV RUST_ENV=production
USER rust
WORKDIR /home/rust
HEALTHCHECK --timeout=10s --interval=10s CMD [ "wget", "http://127.0.0.1:7001/ping", "-q", "-O", "-"]
CMD ["diving", "--mode", "web", "--listen", "0.0.0.0:7001"]
ENTRYPOINT ["/entrypoint.sh"]