-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (36 loc) · 1.29 KB
/
Dockerfile
File metadata and controls
50 lines (36 loc) · 1.29 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
45
46
47
48
49
50
ARG PROJECT_ENTRYPOINT=runner
FROM rust:slim AS build
ARG PROJECT_ENTRYPOINT
WORKDIR /app
# System deps for builds that use OpenSSL / quiche / tquic, etc.
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential cmake ninja-build perl python3 git \
pkg-config clang llvm make ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Cache dependencies and config first
COPY Cargo.toml Cargo.lock ./
COPY .cargo ./.cargo
COPY crates ./crates
RUN cargo fetch
# Build
RUN cargo build --release -p ${PROJECT_ENTRYPOINT}
# Runtime image
FROM debian:trixie-slim AS runtime
ARG PROJECT_ENTRYPOINT
ARG PROJECT_NAME=quic-lab
# Minimal runtime deps
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates tzdata nginx-light tini && \
rm -rf /var/lib/apt/lists/*
# App layout
WORKDIR /app
RUN useradd -r -u 10001 appuser && mkdir -p /app/in && mkdir -p /app/out && chown -R appuser:appuser /app
COPY --from=build /app/target/release/${PROJECT_ENTRYPOINT} /app/${PROJECT_NAME}
# index.html for opt out
COPY ./index.html /var/www/html/index.html
# simple supervisor script
COPY ./docker-entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
ENV SSLKEYLOGFILE=/app/out/sslkeylogfile.txt
EXPOSE 80
ENTRYPOINT ["tini","-g","--","/app/entrypoint.sh"]