forked from meetsmore/nittei
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebian.Dockerfile
More file actions
44 lines (32 loc) · 1.38 KB
/
Copy pathdebian.Dockerfile
File metadata and controls
44 lines (32 loc) · 1.38 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
# Usage:
# docker buildx build -f debian.Dockerfile -t image:tag --build-arg='ARCH=x86_64' --platform linux/amd64 .
# docker buildx build -f debian.Dockerfile -t image:tag --build-arg='ARCH=aarch64' --platform linux/arm64 .
FROM rust:1.94.0-slim AS builder
WORKDIR /app/nittei
RUN apt update \
&& apt install -y --no-install-recommends curl openssl ca-certificates pkg-config build-essential libssl-dev \
&& apt clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY ./Cargo.toml ./Cargo.lock .cargo ./
COPY ./clients/rust ./clients/rust
COPY ./crates ./crates
COPY ./bins ./bins
RUN cargo build --locked --release && \
cp ./target/release/nittei /nittei && \
cargo build --locked --release --bin nittei-migrate && \
cp ./target/release/nittei-migrate /nittei-migrate
# Use the distroless base image for final image
FROM gcr.io/distroless/cc-debian12
# Set the git repository url and commit hash for DD
ARG GIT_REPO_URL
ARG GIT_COMMIT_HASH
ENV DD_GIT_REPOSITORY_URL=${GIT_REPO_URL}
ENV DD_GIT_COMMIT_SHA=${GIT_COMMIT_HASH}
ENV DD_SOURCE_CODE_PATH_MAPPING="/app/nittei/bins:/bins,/app/nittei/crates:/crates"
# Set the backtrace level by default to 1
ARG RUST_BACKTRACE=1
ENV RUST_BACKTRACE=${RUST_BACKTRACE}
USER nonroot:nonroot
COPY --from=builder --chown=nonroot:nonroot /nittei /nittei
COPY --from=builder --chown=nonroot:nonroot /nittei-migrate /nittei-migrate
CMD ["/nittei"]