lonk/Dockerfile

25 lines
485 B
Docker

# Create the build container to compile
FROM rust:latest as builder
RUN USER=root cargo new --bin lonk
WORKDIR lonk
# Compile dependencies
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
ARG PROFILE
RUN cargo build
RUN rm src/*.rs
# Compile the source
COPY ./src ./src
RUN rm ./target/${PROFILE:-release}/deps/lonk*
RUN cargo build
# Execution container
FROM rust:latest
ARG PROFILE
COPY --from=builder /lonk/target/${PROFILE:-release}/lonk .
CMD ["./lonk"]