-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (28 loc) · 970 Bytes
/
Dockerfile
File metadata and controls
33 lines (28 loc) · 970 Bytes
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
FROM rust:bookworm as builder_backend
WORKDIR /app
COPY backend/Cargo.toml backend/Cargo.lock ./
RUN mkdir src && echo "fn main() { println!(\"Hello world\") }" > src/main.rs
RUN cargo fetch
RUN cargo build --release
RUN rm src/main.rs
RUN mkdir leaderboard
COPY ./backend/src/ ./src/
RUN touch src/main.rs
RUN cargo test --release && cargo build --release
FROM node:alpine as builder_frontend
WORKDIR /app
COPY frontend/package.json frontend/package-lock.json ./
RUN npm install
COPY --from=builder_backend /app/bindings ./backend/bindings
COPY ./frontend/ ./frontend
RUN cd frontend && npm run build
FROM debian:bookworm-slim as runner
WORKDIR /app
EXPOSE 80
RUN apt update && apt install -y openssl nginx
COPY ./docker-start.sh .
COPY nginx.conf /etc/nginx/sites-enabled/default
COPY --from=builder_backend /app/target/release/backend ./backend
RUN mkdir leaderboard
COPY --from=builder_frontend /app/frontend/dist ./frontend
CMD [ "sh", "/app/docker-start.sh" ]