-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (39 loc) · 1.81 KB
/
Copy pathDockerfile
File metadata and controls
43 lines (39 loc) · 1.81 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
# syntax=docker/dockerfile:1.7
ARG RUST_VERSION=1.97.1
ARG CELLD_COMMIT=unknown
FROM rust:${RUST_VERSION}-bookworm AS build
ARG TARGETARCH
# `release` for shipped artifacts; a fast-loop caller passes `lab` to skip
# the fat-LTO relink and keep incremental state in the target cache.
ARG CELLD_PROFILE=release
WORKDIR /src
COPY Cargo.toml Cargo.lock ./
COPY crates ./crates
RUN --mount=type=cache,id=celld-cargo-registry,target=/usr/local/cargo/registry,sharing=locked \
--mount=type=cache,id=celld-cargo-git,target=/usr/local/cargo/git,sharing=locked \
--mount=type=cache,id=celld-target-${TARGETARCH},target=/src/target,sharing=locked \
mkdir -p /out && \
cargo build --profile "${CELLD_PROFILE}" --locked -p celld && \
install -m 755 "target/${CELLD_PROFILE}/celld" /out/celld
# The release workflow builds this stage on every candidate push, so a
# break in the engine's own tests or lints stops a release before any
# artifact is drafted.
FROM build AS test
ARG TARGETARCH
RUN rustup component add clippy
RUN --mount=type=cache,id=celld-cargo-registry,target=/usr/local/cargo/registry,sharing=locked \
--mount=type=cache,id=celld-cargo-git,target=/usr/local/cargo/git,sharing=locked \
--mount=type=cache,id=celld-target-${TARGETARCH},target=/src/target,sharing=locked \
cargo test --release --locked && \
cargo clippy --release --all-targets --locked -- -D warnings
FROM debian:bookworm-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*
ARG CELLD_COMMIT
ARG CELLD_VERSION=unknown
LABEL org.opencontainers.image.title="celld" \
org.opencontainers.image.revision="${CELLD_COMMIT}" \
org.opencontainers.image.version="${CELLD_VERSION}"
COPY --from=build /out/celld /usr/local/bin/celld
ENTRYPOINT ["/usr/local/bin/celld"]