-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (41 loc) · 1.58 KB
/
Dockerfile
File metadata and controls
58 lines (41 loc) · 1.58 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
51
52
53
54
55
56
57
58
# syntax=docker/dockerfile:1
# ---- Builder stage ----
FROM rust:1.85-bookworm AS builder
ARG FEATURES=""
WORKDIR /app
# Install build dependencies (protobuf-compiler needed by pprof's prost-codec)
RUN apt-get update && \
apt-get install -y --no-install-recommends pkg-config libssl-dev protobuf-compiler && \
rm -rf /var/lib/apt/lists/*
# Copy manifests first for dependency caching
COPY Cargo.toml Cargo.lock ./
# Create dummy sources to build dependencies as a cached layer
RUN mkdir -p src benches && \
echo "fn main() {}" > src/main.rs && \
echo "" > src/lib.rs && \
echo "fn main() {}" > benches/core_benchmarks.rs && \
cargo build --release ${FEATURES:+--features $FEATURES} && \
rm -rf src benches
# Copy real source code
COPY src/ src/
COPY benches/ benches/
# Touch files so cargo detects changes from the dummy build
RUN touch src/main.rs src/lib.rs && \
cargo build --release ${FEATURES:+--features $FEATURES}
# ---- Runtime stage ----
FROM debian:bookworm-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
# Non-root user
RUN groupadd --system zeppelin && \
useradd --system --gid zeppelin --create-home zeppelin
# Cache directory
RUN mkdir -p /var/cache/zeppelin && \
chown zeppelin:zeppelin /var/cache/zeppelin
COPY --from=builder /app/target/release/zeppelin /usr/local/bin/zeppelin
USER zeppelin
EXPOSE 8080
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080/healthz || exit 1
ENTRYPOINT ["zeppelin"]