2021-04-13 21:43:30 +02:00
|
|
|
# Our entire toolchain runs in alpine
|
2021-04-12 17:39:52 +02:00
|
|
|
FROM alpine:latest AS builder
|
|
|
|
|
|
|
|
ENV PATH "$PATH:/root/.cargo/bin"
|
2021-04-13 21:43:30 +02:00
|
|
|
# Needed for proper compiling of openssl-dev
|
|
|
|
ENV RUSTFLAGS "-C target-feature=-crt-static"
|
2021-04-13 21:56:52 +02:00
|
|
|
# Otherwise, the debug build can't be used from the container
|
|
|
|
ENV ROCKET_ADDRESS "0.0.0.0"
|
2021-04-12 17:39:52 +02:00
|
|
|
|
|
|
|
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/
|