-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
41 lines (26 loc) · 803 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
FROM rust:1.63-alpine3.16 as chef
WORKDIR /echoip
RUN apk update && apk add musl-dev && \
cargo install cargo-chef
FROM chef AS plan
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS build
RUN addgroup -g 10001 echoip && \
adduser -u 10001 -G echoip -h /echoip -D echoip
COPY --from=plan /echoip/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release
FROM scratch as release
LABEL org.opencontainers.image.authors="[email protected]"
USER echoip
ENV RUST_LOG="error,echoip=info"
EXPOSE 8088
COPY --from=build /etc/passwd /etc/passwd
COPY --from=build /echoip/target/release/echoip /echoip/echoip
WORKDIR /echoip
COPY static static
COPY templates templates
COPY geoip geoip
CMD ["/echoip/echoip"]