|
|
@ -39,15 +39,8 @@ RUN apt-get update \
|
|
|
|
ENV CARGO_HOME "/root/.cargo"
|
|
|
|
ENV CARGO_HOME "/root/.cargo"
|
|
|
|
ENV USER "root"
|
|
|
|
ENV USER "root"
|
|
|
|
|
|
|
|
|
|
|
|
# Creates a dummy project used to grab dependencies
|
|
|
|
|
|
|
|
RUN USER=root cargo new --bin app
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
# Copies over *only* your manifests and vendored dependencies
|
|
|
|
|
|
|
|
COPY ./Cargo.* ./
|
|
|
|
|
|
|
|
COPY ./libs ./libs
|
|
|
|
|
|
|
|
COPY ./rust-toolchain ./rust-toolchain
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Prepare openssl armhf libs
|
|
|
|
# Prepare openssl armhf libs
|
|
|
|
RUN sed 's/^deb/deb-src/' /etc/apt/sources.list > \
|
|
|
|
RUN sed 's/^deb/deb-src/' /etc/apt/sources.list > \
|
|
|
|
/etc/apt/sources.list.d/deb-src.list \
|
|
|
|
/etc/apt/sources.list.d/deb-src.list \
|
|
|
@ -62,19 +55,12 @@ ENV CROSS_COMPILE="1"
|
|
|
|
ENV OPENSSL_INCLUDE_DIR="/usr/include/arm-linux-gnueabihf"
|
|
|
|
ENV OPENSSL_INCLUDE_DIR="/usr/include/arm-linux-gnueabihf"
|
|
|
|
ENV OPENSSL_LIB_DIR="/usr/lib/arm-linux-gnueabihf"
|
|
|
|
ENV OPENSSL_LIB_DIR="/usr/lib/arm-linux-gnueabihf"
|
|
|
|
|
|
|
|
|
|
|
|
# Builds your dependencies and removes the
|
|
|
|
|
|
|
|
# dummy project, except the target folder
|
|
|
|
|
|
|
|
# This folder contains the compiled dependencies
|
|
|
|
|
|
|
|
RUN rustup target add armv7-unknown-linux-gnueabihf
|
|
|
|
|
|
|
|
RUN cargo build --release --target=armv7-unknown-linux-gnueabihf -v
|
|
|
|
|
|
|
|
RUN find . -not -path "./target*" -delete
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Copies the complete project
|
|
|
|
# Copies the complete project
|
|
|
|
# To avoid copying unneeded files, use .dockerignore
|
|
|
|
# To avoid copying unneeded files, use .dockerignore
|
|
|
|
COPY . .
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
|
|
|
|
# Builds again, this time it'll just be
|
|
|
|
# Build
|
|
|
|
# your actual source files being built
|
|
|
|
RUN rustup target add armv7-unknown-linux-gnueabihf
|
|
|
|
RUN cargo build --release --target=armv7-unknown-linux-gnueabihf -v
|
|
|
|
RUN cargo build --release --target=armv7-unknown-linux-gnueabihf -v
|
|
|
|
|
|
|
|
|
|
|
|
######################## RUNTIME IMAGE ########################
|
|
|
|
######################## RUNTIME IMAGE ########################
|
|
|
|