-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
46 lines (31 loc) · 976 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
43
44
45
46
# build frontend
FROM node:lts as frontend-builder
WORKDIR /usr/src/app
RUN corepack enable pnpm
RUN corepack use pnpm@8
RUN mkdir -p client
COPY client/package.json client/pnpm-lock.yaml ./client/
RUN cd client && pnpm install --frozen-lockfile
COPY client ./client
RUN cd client && pnpm build
# build backend
FROM rust:1.76 as backend-builder
WORKDIR /usr/src/app
COPY ./Cargo.toml ./Cargo.toml
COPY ./Cargo.lock ./Cargo.lock
RUN mkdir src && touch src/lib.rs
RUN cargo build --release
COPY ./src ./src
COPY ./migrations ./migrations
RUN cargo build --release
# application
FROM debian:bookworm-slim
WORKDIR /usr/src/app
RUN apt-get update && apt-get install -y libssl-dev libmariadb-dev ca-certificates && rm -rf /var/lib/apt/lists/*
COPY README.md README.md
COPY LICENSE LICENSE
RUN mkdir -p public
COPY --from=frontend-builder /usr/src/app/public ./public
COPY --from=backend-builder /usr/src/app/target/release/conf-ops ./
CMD ["./conf-ops"]
EXPOSE 8000