-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (35 loc) · 1 KB
/
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
43
FROM rust:1.69.0-bullseye as chef
RUN cargo install cargo-chef --locked
WORKDIR /app
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
libssl-dev \
pkg-config \
&& \
rm -rf /var/lib/apt/lists/*
FROM chef AS planner
COPY Cargo.* ./
COPY src src
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
COPY Cargo.* ./
COPY src src
FROM builder AS builder-hub-permissions-cli
RUN cargo build --release
FROM debian:bullseye-slim as base
WORKDIR /app
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
ca-certificates \
libpq5 \
libssl1.1 \
&& \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p bin
FROM base AS hub-permissions-cli
COPY --from=builder-hub-permissions-cli /app/target/release/hub-permissions-cli /bin/
ENTRYPOINT ["/bin/hub-permissions-cli"]