-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (30 loc) · 1.46 KB
/
Copy pathDockerfile
File metadata and controls
42 lines (30 loc) · 1.46 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
# ── Stage 1: Build the frontend ─────────────────────────────────────────────
FROM node:22-alpine AS frontend-builder
WORKDIR /app/web
COPY web/package.json web/package-lock.json* ./
RUN npm ci
COPY web/ ./
RUN npm run build
# ── Stage 2: Build the Rust binary ──────────────────────────────────────────
FROM rust:1.96-alpine3.23 AS backend-builder
RUN apk add --no-cache musl-dev pkgconf openssl-dev perl make
WORKDIR /app
# Cache dependencies by copying manifests first
COPY Cargo.toml Cargo.lock ./
# Build a dummy main so Cargo fetches and compiles deps
RUN mkdir src && echo 'fn main() {}' > src/main.rs && \
cargo build --release && \
rm -rf src
# Build the real binary
COPY src/ src/
COPY migrations/ migrations/
RUN touch src/main.rs && cargo build --release
# ── Stage 3: Minimal runtime image ──────────────────────────────────────────
FROM alpine:3.23
RUN apk add --no-cache ca-certificates libssl3 tini
WORKDIR /app
COPY --from=backend-builder /app/target/release/dabeacon_indexer /app/dabeacon_indexer
COPY --from=backend-builder /app/migrations /app/migrations
COPY --from=frontend-builder /app/web/build /app/web/build
EXPOSE 3000
ENTRYPOINT ["/sbin/tini", "--", "/app/dabeacon_indexer"]