-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (28 loc) · 1.4 KB
/
Dockerfile
File metadata and controls
36 lines (28 loc) · 1.4 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
# ── Stage 1: Build React frontend ───────────────────────────────────
FROM node:22-slim AS frontend-build
WORKDIR /app/dashboard
COPY dashboard/package.json dashboard/package-lock.json ./
RUN npm ci
COPY dashboard/ .
RUN npm run build
# ── Stage 2: Build Rust backend (with embedded frontend) ────────────
FROM rust:1.88-slim AS backend-build
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends pkg-config libssl-dev gcc libc6-dev make libsodium-dev && rm -rf /var/lib/apt/lists/*
COPY Cargo.toml Cargo.lock ./
COPY crates/ crates/
COPY --from=frontend-build /app/dashboard/dist dashboard/dist
ENV SODIUM_USE_PKG_CONFIG=1
RUN cargo build --release --bin fishnet --features embed-dashboard
# ── Stage 3: Runtime (single binary, no extra files) ────────────────
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates libsodium23 && rm -rf /var/lib/apt/lists/*
RUN useradd -m -s /bin/bash fishnet
WORKDIR /home/fishnet
COPY --from=backend-build /app/target/release/fishnet /usr/local/bin/fishnet
RUN mkdir -p /var/lib/fishnet /home/fishnet && chown -R fishnet:fishnet /var/lib/fishnet /home/fishnet
USER fishnet
ENV FISHNET_HOST=0.0.0.0
ENV FISHNET_DATA_DIR=/var/lib/fishnet
EXPOSE 8473
CMD ["fishnet"]