-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·44 lines (31 loc) · 1.17 KB
/
Dockerfile
File metadata and controls
executable file
·44 lines (31 loc) · 1.17 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
# syntax=docker/dockerfile:1.7
FROM rust:1.94-slim-trixie AS builder
WORKDIR /app/api
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# COPY ./lib /app/lib
COPY ./Cargo.toml ./Cargo.lock ./
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 mesa-api \
&& cp /cargo-target/release/mesa-api /usr/local/bin/mesa-api
FROM debian:trixie-slim AS runtime
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libssl3t64 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/bin/mesa-api /usr/local/bin/mesa-api
RUN useradd --system --uid 10001 --create-home mesaapi
USER mesaapi
EXPOSE 8080
CMD ["/usr/local/bin/mesa-api"]