-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (51 loc) · 1.82 KB
/
Dockerfile
File metadata and controls
68 lines (51 loc) · 1.82 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
# syntax=docker/dockerfile:1.6
############################
# 1. Build Astro website (includes Vue islands)
############################
FROM node:20-alpine AS website-build
WORKDIR /build
# Install frontend deps (needed for tsconfig resolution via path alias)
COPY frontend/package.json frontend/package-lock.json* ./frontend/
RUN cd frontend && npm ci
# Copy frontend source (consumed by Astro via path alias)
COPY frontend/ ./frontend/
# Install website deps
COPY website/package.json website/package-lock.json* ./website/
WORKDIR /build/website
RUN npm ci
# Copy website source and build
COPY website/ ./
RUN npm run build
############################
# 2. Build Rust backend
############################
FROM rust:1.86-slim AS backend-build
WORKDIR /build
RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config libssl-dev ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY backend/Cargo.toml backend/Cargo.lock* ./
RUN mkdir -p src && echo "fn main() {}" > src/main.rs \
&& cargo build --release \
&& rm -rf src target/release/deps/evmore_dashboard*
COPY backend/ ./
RUN cargo build --release
############################
# 3. Runtime image
############################
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd -r app && useradd -r -g app app
WORKDIR /app
COPY --from=backend-build /build/target/release/evmore-dashboard /app/evmore-dashboard
COPY --from=website-build /build/website/dist /app/public
ENV PORT=8080 \
STATIC_DIR=/app/public \
RUST_LOG=info
EXPOSE 8080
USER app
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD curl -fsS http://127.0.0.1:${PORT}/api/health || exit 1
CMD ["/app/evmore-dashboard"]