Repository navigation
Expand file tree
/
Copy pathDockerfile.dev
More file actions
71 lines (55 loc) · 1.92 KB
/
Copy pathDockerfile.dev
File metadata and controls
71 lines (55 loc) · 1.92 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
59
60
61
62
63
64
65
66
67
68
69
70
71
# Stage 1: Build
FROM rust:1.99-bookworm@sha256:e12566d5abc17a0da741628782cdb504b68b8961f5bfcf677936bf3e8b32de29 AS builder
WORKDIR /app
# Install build dependencies (Debian) + Node.js 20
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
libssl-dev \
libsqlite3-dev \
ca-certificates \
curl \
gnupg \
&& rm -rf /var/lib/apt/lists/* \
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& npm install -g pnpm \
&& rm -rf /var/lib/apt/lists/*
# Copy project files (node_modules excluded by .dockerignore)
COPY Cargo.lock* ./
COPY Cargo.toml ./
COPY package.json ./
COPY pnpm-lock.yaml ./
COPY pnpm-workspace.yaml ./
COPY rust-toolchain.toml ./
COPY crates crates
COPY apps apps
# Install workspace dashboard deps from root
RUN pnpm install --frozen-lockfile --ignore-scripts
# Build the project
RUN cargo build --bin rook --release 2>&1
# Stage 2: Minimal runtime
FROM debian:bookworm-slim@sha256:7c7b2c966bc9ee8cedfeef67e0e279108992c77681fa595db4a9d65c06ccc587
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
libssl3 \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy binary from builder (release build)
COPY --from=builder /app/target/release/rook /usr/local/bin/rook
# Copy test config
COPY dev/test-configs/rook-minimal.toml /app/rook.toml
# Expose default port
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Set config path via env var
ENV ROOK_CONFIG=/app/rook.toml
# Create non-root user (required for USER directive)
RUN useradd -r -m -s /bin/false -u 1000 non-root 2>&1 || true \
&& chown -R non-root:non-root /app
USER non-root
ENTRYPOINT ["/usr/local/bin/rook"]