-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
74 lines (53 loc) · 1.67 KB
/
Dockerfile
File metadata and controls
74 lines (53 loc) · 1.67 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
69
70
71
72
73
74
# Multi-stage Dockerfile for UET Platform
# Builds: uet_api (Rust backend), uet_web (Next.js frontend)
# ==================== Rust Backend Build ====================
FROM rust:slim-bookworm AS rust-builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y pkg-config libssl-dev protobuf-compiler && rm -rf /var/lib/apt/lists/*
# Copy Cargo workspace files
COPY Cargo.toml Cargo.lock ./
COPY uet_core ./uet_core
COPY uet_kb ./uet_kb
COPY uet_api ./uet_api
# Build the API binary
RUN cargo build --release -p uet_api
# ==================== Node Frontend Build ====================
FROM node:20-alpine AS node-builder
WORKDIR /app
# Copy package files
COPY uet_web/package*.json ./
# Install dependencies
RUN npm ci
# Copy source
COPY uet_web ./
# Build Next.js
RUN npm run build
# ==================== Runtime Stage ====================
FROM debian:bookworm-slim
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*
# Copy Rust API binary
COPY --from=rust-builder /app/target/release/uet_api /usr/local/bin/uet_api
# Copy Node.js app
COPY --from=node-builder /app/.next ./uet_web/.next
COPY --from=node-builder /app/public ./uet_web/public
COPY --from=node-builder /app/package*.json ./uet_web/
COPY --from=node-builder /app/node_modules ./uet_web/node_modules
# Copy migrations
COPY uet_api/migrations ./migrations
# Environment
ENV RUST_LOG=info
ENV NODE_ENV=production
# Expose ports (API: 3001, Web: 3000)
EXPOSE 3000 3001
# Start script will run both services
COPY start.sh /start.sh
RUN chmod +x /start.sh
CMD ["/start.sh"]