-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev.alpine
More file actions
51 lines (39 loc) · 1.04 KB
/
Copy pathDockerfile.dev.alpine
File metadata and controls
51 lines (39 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
48
49
50
51
# Stage 1: Build
FROM rust:1.89-alpine AS builder
WORKDIR /app
# Install build dependencies (Alpine)
RUN apk add --no-cache \
musl-dev \
openssl-dev \
pkgconfig \
sqlite-dev \
ca-certificates \
build-base
# Copy manifests first for dependency caching
COPY Cargo.lock* ./
COPY Cargo.toml ./
COPY rust-toolchain.toml ./
COPY crates crates
COPY apps apps
# Build the project
RUN cargo build --bin rook --release 2>&1
# Stage 2: Minimal runtime
FROM alpine:3.20
WORKDIR /app
# Install runtime dependencies
RUN apk add --no-cache \
ca-certificates \
openssl \
sqlite \
libstdc++ \
libgcc
# Copy binary from builder (release build)
COPY --from=builder /app/target/release/rook /usr/local/bin/rook
COPY dev/test-configs/rook-minimal.toml /app/rook.toml
RUN addgroup --system non-root \
&& adduser --system --ingroup non-root --disabled-password --gecos '' non-root \
&& chown -R non-root:non-root /usr/local/bin/rook /app
EXPOSE 8080
USER non-root
ENTRYPOINT ["rook"]
CMD ["--config", "/app/rook.toml"]