-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
40 lines (26 loc) · 823 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
ARG RUST_VERSION=1.77
ARG APP_NAME=backend
FROM rust:${RUST_VERSION}-slim-bullseye AS build
LABEL author="dvorak"
LABEL email="[email protected]"
ARG APP_NAME
WORKDIR /app
COPY ./backend/Cargo.toml ./backend/Cargo.toml
RUN mkdir ./backend/src
RUN echo "fn main() {}" > ./backend/src/main.rs
COPY ./share/Cargo.toml ./share/Cargo.toml
RUN mkdir ./share/src
RUN echo "" > ./share/src/lib.rs
RUN cargo build --release --manifest-path ./backend/Cargo.toml
RUN rm ./backend -rf
RUN rm ./share -rf
COPY ./backend ./backend
COPY ./share ./share
RUN cargo build --release --manifest-path ./backend/Cargo.toml
FROM debian:bullseye-slim AS final
USER root
COPY --from=build /app/backend/target/release/backend /bin/server
COPY --from=build /app/backend/epic.db /bin/epic.db
EXPOSE 8080
WORKDIR /bin
CMD ["server"]