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
# syntax=docker/dockerfile:1
FROM rust:1.97-bookworm AS builder
WORKDIR /app
# rusqlite is bundled (needs a C compiler); rustls/ring and git deps need the rest.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
COPY .cargo ./.cargo
COPY src ./src
RUN cargo build --release --locked
FROM debian:bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd --system --gid 10001 vuln-notif \
&& useradd --system --uid 10001 --gid vuln-notif \
--home-dir /data --no-create-home --shell /usr/sbin/nologin vuln-notif \
&& mkdir -p /data \
&& chown vuln-notif:vuln-notif /data
COPY --from=builder --chown=vuln-notif:vuln-notif \
/app/target/release/vuln-notif /usr/local/bin/vuln-notif
WORKDIR /data
USER vuln-notif
ENTRYPOINT ["vuln-notif"]