Add a nice optimized dockerfile for deployment

This commit is contained in:
Aleksei Voronov 2023-10-05 20:20:06 +02:00
parent 70f9733112
commit 2062f0bb89
1 changed files with 18 additions and 0 deletions

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM rust:1.72
RUN USER=root cargo new --bin nederlandskie
WORKDIR /nederlandskie
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
RUN cargo build --release
RUN rm src/*.rs
COPY ./src ./src
RUN rm ./target/release/deps/nederlandskie*
RUN cargo build --release
EXPOSE 3000
CMD ["./target/release/nederlandskie"]