-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (32 loc) · 1.01 KB
/
Dockerfile
File metadata and controls
49 lines (32 loc) · 1.01 KB
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
45
46
47
48
49
FROM rust:1.92 AS base
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 askama.toml .
COPY Cargo.toml .
COPY Cargo.lock .
COPY migrations migrations
COPY .sqlx .sqlx
COPY src src
COPY web web
# Precompress static web assets with gzip to avoid paying for their compression cost at runtime
RUN gzip --keep --best --force --recursive web/assets
ARG GIT_VERSION=unknown
ENV GIT_VERSION=${GIT_VERSION}
RUN cargo build --release
FROM ubuntu:24.04 AS runtime
WORKDIR /
# curl is needed for healthcheck
# git is needed for local git operations
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates curl git
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"]