# We use a multi-stage build to end up with a very small final image FROM alpine:latest AS builder ARG MODE ARG RUN_TESTS ENV PATH "$PATH:/root/.cargo/bin" # Needed for proper compiling of openssl-dev ENV RUSTFLAGS="-C target-feature=-crt-static" WORKDIR /usr/src/app # Install build dependencies, rustup & rust's nightly build & toolchain RUN apk update && apk add --no-cache openssl-dev build-base curl && \ { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly; } # Copy source code over to builder COPY Cargo.toml Cargo.lock ./ COPY src/ ./src/