-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
42 lines (31 loc) · 934 Bytes
/
Dockerfile
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 frontend
FROM node:21.6.1-slim AS frontend-builder
WORKDIR /app/client
COPY client/package.json ./
COPY client/package-lock.json ./
#RUN npm install
RUN npm ci --prefer-offline
COPY client .
RUN npm run build
# Stage 2: Build backend
FROM rust:1.75.0-bookworm AS backend-builder
RUN cargo new --bin app/server
WORKDIR /app/server
COPY server/Cargo.toml ./
COPY server/Cargo.lock ./
RUN cargo build --release
COPY server/src ./src
COPY server/migrations ./migrations
COPY --from=frontend-builder /app/client/dist /app/client/dist
RUN touch src/main.rs
RUN cargo build --release
# Stage 3: Final image
FROM debian:bookworm-slim
# install libssl
RUN apt-get update -y && \
apt-get install -y --no-install-recommends libssl-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY --from=backend-builder /app/server/target/release/axum-solid-playground /app/main
EXPOSE 3000
CMD "/app/main"