FROM rustlang/rust:nightly AS rust
ENV PROJECT_PATH .
ENV APP_LABEL app
# Cache deps
WORKDIR /app
# Install cache-deps
RUN cargo install --git https://github.com/romac/cargo-build-deps.git
# Diesel Cli
RUN cargo install diesel_cli --no-default-features --features postgres
# Copy the Cargo tomls
COPY ${PROJECT_PATH}/Cargo.toml ./
# Cache the deps
RUN cargo build-deps
# Copy the src folders
COPY ${PROJECT_PATH}/src ./src/
# Build for debug
RUN cargo build
WORKDIR /app/src
CMD ["/bin/bash"]