forked from availproject/avail-light
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (22 loc) · 985 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
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
WORKDIR /app
LABEL org.opencontainers.image.source=https://github.com/availproject/avail-light
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
ARG BUILD_PROFILE=release
ENV BUILD_PROFILE $BUILD_PROFILE
RUN apt-get update && apt-get -y upgrade && apt-get install -y cmake libclang-dev
RUN cargo chef cook --profile $BUILD_PROFILE --recipe-path recipe.json
COPY . .
RUN cargo build --profile $BUILD_PROFILE --locked --bin avail-light
RUN cp /app/target/$BUILD_PROFILE/avail-light /app/avail-light
FROM ubuntu as run
WORKDIR /app
RUN apt-get update && apt-get install -y ca-certificates
COPY --from=builder /app/config.yaml /app/config.yaml
COPY --from=builder /app/avail-light /usr/local/bin
EXPOSE 80 443 7001 37000
CMD ["/bin/bash", "-c", "while true; do /usr/local/bin/avail-light -c /app/config.yaml; sleep 20; done"]