-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
70 lines (54 loc) · 1.78 KB
/
Copy pathDockerfile.dev
File metadata and controls
70 lines (54 loc) · 1.78 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
# Stage 1: Build
FROM rust:1.89-bookworm 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 rust-toolchain.toml ./
COPY crates crates
COPY apps apps
# Install dashboard deps FIRST (before any further COPY overwrites node_modules)
WORKDIR /app/apps/rook/dashboard
RUN pnpm install --include=dev --ignore-scripts
# Build the project
WORKDIR /app
RUN cargo build --bin rook --release 2>&1
# Stage 2: Minimal runtime
FROM debian:bookworm-slim
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"]