-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (34 loc) · 1.13 KB
/
Dockerfile
File metadata and controls
51 lines (34 loc) · 1.13 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 frontend
FROM node:20-alpine AS frontend-builder
WORKDIR /app/frontend
# Copy frontend files
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ ./
RUN npm run build
# Stage 2: Build Rust backend
FROM rustlang/rust:nightly-bookworm AS builder
RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy manifests
COPY Cargo.toml Cargo.lock* ./
# Create dummy main.rs to cache dependencies
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build --release
RUN rm -rf src
# Copy source code
COPY src ./src
COPY config.toml ./
# Copy built frontend from frontend-builder
COPY --from=frontend-builder /app/static ./static
# Build application
RUN touch src/main.rs && cargo build --release
# Stage 3: Runtime
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/target/release/kartex-logging-rust .
COPY --from=builder /app/static ./static
COPY --from=builder /app/config.toml ./
EXPOSE 8443 9514/udp 4317 4318 12201/udp 514/udp 1514
CMD ["./kartex-logging-rust"]