-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (34 loc) · 1.04 KB
/
Dockerfile
File metadata and controls
47 lines (34 loc) · 1.04 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
# Stage 1: Build
FROM rust:1.85-slim AS builder
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
cmake \
g++ \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Cache dependency builds: copy manifests first
COPY Cargo.toml Cargo.lock ./
# Create a dummy main.rs to build dependencies
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build --release || true
# Copy real source
COPY src/ src/
COPY benches/ benches/
COPY janus.toml ./
# Touch main.rs so cargo rebuilds with real source
RUN touch src/main.rs
RUN cargo build --release
# Stage 2: Runtime
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/janus /usr/local/bin/janus
COPY --from=builder /app/janus.toml /etc/janus/janus.toml
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s \
CMD curl -f http://localhost:8080/health || exit 1
ENTRYPOINT ["janus"]
CMD ["serve", "--config", "/etc/janus/janus.toml", "--no-tui"]