-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
56 lines (40 loc) · 1.33 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Build-Stage
FROM rust:latest as builder
WORKDIR /usr/src/app
ARG FEATURES=""
# Diesel CLI installieren
RUN cargo install diesel_cli --no-default-features --features sqlite
# Rust-Abhängigkeiten cachen
COPY backend/Cargo.toml ./
#RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo build --release && rm -r src
# Anwendung bauen
COPY ./backend/ ./
RUN cargo build $FEATURES --release
# 2. Frontend Build Stage
FROM node:22 AS frontend-builder
WORKDIR /frontend
#Copy Frontend source code
COPY frontend/package.json /frontend/
RUN npm install
COPY .git/ /frontend/.git/
COPY frontend/ /frontend/
RUN npm run build:prod
# Runtime-Stage
FROM debian:bookworm-slim
WORKDIR /usr/src/app
# Laufzeitabhängigkeiten installieren
RUN apt-get update && apt-get install -y libsqlite3-dev ca-certificates && rm -rf /var/lib/apt/lists/*
# Diesel CLI aus dem Build-Container kopieren
COPY --from=builder /usr/local/cargo/bin/diesel /usr/local/bin/diesel
# Anwendung und Migrations kopieren
COPY --from=builder /usr/src/app/target/release/backend ./
COPY --from=builder /usr/src/app/migrations ./migrations
#COPY ./backend/static ./static
COPY --from=frontend-builder /frontend/dist ./static
# Startskript hinzufügen
COPY entrypoint.sh ./entrypoint.sh
RUN chmod +x ./entrypoint.sh
RUN ls -la
# Standard-Befehl
ENTRYPOINT ["./entrypoint.sh"]
EXPOSE 8000