wip: still tuning Dockerfile

This commit is contained in:
meeg_leeto 2022-04-15 01:24:04 +01:00
parent b53646cb64
commit ddff9bdbfb
1 changed files with 8 additions and 6 deletions

View File

@ -1,19 +1,21 @@
# Prepare container
FROM rust:slim-buster
RUN USER=root cargo new --bin lonk
WORKDIR lonk
WORKDIR /lonk
# Compile dependencies
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
COPY ./Cargo.lock /lonk/Cargo.lock
COPY ./Cargo.toml /lonk/Cargo.toml
RUN cargo build
RUN rm src/*.rs
RUN rm /lonk/src/*.rs
# Compile the source
COPY ./src ./src
COPY ./src /lonk/src
RUN rm /lonk/target/${PROFILE:-debug}/deps/lonk*
RUN cargo build
RUN cp /lonk/target/${PROFILE:-debug}/lonk .
RUN cp /lonk/target/${PROFILE:-debug}/lonk /bin/lonk
WORKDIR /bin
CMD ["./lonk"]