forked from rust-lang/bors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (26 loc) · 800 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 rust:1.82 AS base
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
RUN cargo install cargo-chef
FROM base AS planner
WORKDIR /app
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM base AS build
WORKDIR /app
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY Cargo.toml .
COPY Cargo.lock .
COPY migrations migrations
COPY .sqlx .sqlx
COPY src src
RUN cargo build --release
FROM ubuntu:22.04 AS runtime
WORKDIR /
# curl is needed for healthcheck
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates curl
COPY --from=build /app/target/release/bors .
EXPOSE 80
HEALTHCHECK --timeout=10s --start-period=10s \
CMD curl -f http://localhost/health || exit 1
ENTRYPOINT ["./bors"]