-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·41 lines (30 loc) · 1.18 KB
/
Dockerfile
File metadata and controls
executable file
·41 lines (30 loc) · 1.18 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
# syntax=docker/dockerfile:1.7
FROM rust:1.94-slim-trixie AS builder
WORKDIR /app/black-mesa
RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config \
libssl-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# COPY ./lib /app/lib
COPY ./Cargo.toml ./Cargo.lock ./build.rs ./
COPY ./src/main.rs ./src/main.rs
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
cargo fetch
COPY ./src ./src
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/cargo-target \
CARGO_TARGET_DIR=/cargo-target cargo build --release --bin black-mesa \
&& cp /cargo-target/release/black-mesa /usr/local/bin/black-mesa
FROM debian:trixie-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libssl3t64 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /usr/local/bin/black-mesa /usr/local/bin/black-mesa
RUN useradd --system --uid 10001 --create-home blackmesa
USER blackmesa
ENTRYPOINT ["black-mesa"]