-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
41 lines (30 loc) · 1.08 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
FROM rust:1.51 as depbuild
# This is a stage with built dependencies and a dummy server project
WORKDIR /usr/src
COPY ./Cargo.toml ./Cargo.toml
COPY ./Cargo.lock ./Cargo.lock
COPY ./core ./core
# TODO: find a way to avoid adding client to the workspace
COPY ./client ./client
RUN cargo new --bin --name noxious-server server
COPY ./server/Cargo.toml ./server/Cargo.toml
RUN cargo build --release --package noxious-server
RUN rm -f ./target/release/deps/noxious_server*
RUN rm ./target/release/noxious-server*
# -----------
FROM rust:1.51 as serverbuild
WORKDIR /usr/src
COPY --from=depbuild /usr/src/Cargo.toml ./Cargo.toml
COPY --from=depbuild /usr/src/Cargo.lock ./Cargo.lock
COPY --from=depbuild /usr/src/core ./core
COPY --from=depbuild /usr/src/client ./client
COPY --from=depbuild /usr/src/target ./target
COPY ./server ./server
RUN cargo build --release --package noxious-server
# -----------
FROM debian:buster-slim as server
WORKDIR /app
COPY --from=serverbuild /usr/src/target/release/noxious-server ./noxious-server
EXPOSE 8474
ENTRYPOINT ["./noxious-server"]
CMD ["--host=0.0.0.0"]