# vim: filetype=dockerfile # Our entire toolchain runs in alpine FROM alpine:3.15.0 AS builder ENV PATH "$PATH:/root/.cargo/bin" # Needed for proper compiling of openssl-dev ENV RUSTFLAGS "-C target-feature=-crt-static" # Add the build user # Install dependencies RUN addgroup -S builder && \ adduser -S builder -G builder -h /app && \ apk update && \ apk add --no-cache \ curl \ gcc \ libgcc \ musl-dev \ openssl-dev \ postgresql-dev # Install rustup in the new user's home # Create mountpoints for volumes with correct permissions RUN { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly; } && \ rustup target add x86_64-unknown-linux-musl --toolchain nightly