@ -9,13 +9,13 @@
{ % elif "amd64" in target_file %}
{ % elif "amd64" in target_file %}
{ % set runtime_stage_base_image = "debian:buster-slim" %}
{ % set runtime_stage_base_image = "debian:buster-slim" %}
{ % set package_arch_name = "" %}
{ % set package_arch_name = "" %}
{ % elif "a arch64 " in target_file %}
{ % elif "a rm64v8 " in target_file %}
{ % set runtime_stage_base_image = "balenalib/aarch64-debian:buster" %}
{ % set runtime_stage_base_image = "balenalib/aarch64-debian:buster" %}
{ % set package_arch_name = "arm64" %}
{ % set package_arch_name = "arm64" %}
{ % elif "arm v6" in target_file %}
{ % elif "arm 32 v6" in target_file %}
{ % set runtime_stage_base_image = "balenalib/rpi-debian:buster" %}
{ % set runtime_stage_base_image = "balenalib/rpi-debian:buster" %}
{ % set package_arch_name = "armel" %}
{ % set package_arch_name = "armel" %}
{ % elif "arm v7" in target_file %}
{ % elif "arm 32 v7" in target_file %}
{ % set runtime_stage_base_image = "balenalib/armv7hf-debian:buster" %}
{ % set runtime_stage_base_image = "balenalib/armv7hf-debian:buster" %}
{ % set package_arch_name = "armhf" %}
{ % set package_arch_name = "armhf" %}
{ % endif %}
{ % endif %}
@ -73,7 +73,7 @@ RUN rustup set profile minimal
ENV USER "root"
ENV USER "root"
ENV RUSTFLAGS = '-C link-arg=-s'
ENV RUSTFLAGS = '-C link-arg=-s'
{ % elif "a arch64" in target_file or "armv " in target_file %}
{ % elif "a rm32" in target_file or "arm64 " in target_file %}
# Install required build libs for {{ package_arch_name }} architecture.
# Install required build libs for {{ package_arch_name }} architecture.
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 \
@ -85,7 +85,7 @@ RUN sed 's/^deb/deb-src/' /etc/apt/sources.list > \
libc6-dev{ { package_arch_prefix } }
libc6-dev{ { package_arch_prefix } }
{ % endif -%}
{ % endif -%}
{ % if "a arch64 " in target_file %}
{ % if "a rm64v8 " in target_file %}
RUN apt-get update \
RUN apt-get update \
&& apt-get install -y \
&& apt-get install -y \
--no-install-recommends \
--no-install-recommends \
@ -97,7 +97,7 @@ RUN apt-get update \
ENV CARGO_HOME "/root/.cargo"
ENV CARGO_HOME "/root/.cargo"
ENV USER "root"
ENV USER "root"
{ % elif "arm v6" in target_file %}
{ % elif "arm 32 v6" in target_file %}
RUN apt-get update \
RUN apt-get update \
&& apt-get install -y \
&& apt-get install -y \
--no-install-recommends \
--no-install-recommends \
@ -109,19 +109,7 @@ RUN apt-get update \
ENV CARGO_HOME "/root/.cargo"
ENV CARGO_HOME "/root/.cargo"
ENV USER "root"
ENV USER "root"
{ % elif "armv6" in target_file %}
{ % elif "arm32v7" in target_file %}
RUN apt-get update \
&& apt-get install -y \
--no-install-recommends \
gcc-arm-linux-gnueabihf \
&& mkdir -p ~/.cargo \
&& echo '[target.armv7-unknown-linux-gnueabihf]' >> ~/.cargo/config \
&& echo 'linker = "arm-linux-gnueabihf-gcc"' >> ~/.cargo/config
ENV CARGO_HOME "/root/.cargo"
ENV USER "root"
{ % elif "armv7" in target_file %}
RUN apt-get update \
RUN apt-get update \
&& apt-get install -y \
&& apt-get install -y \
--no-install-recommends \
--no-install-recommends \
@ -162,17 +150,17 @@ COPY ./Cargo.* ./
COPY ./rust-toolchain ./rust-toolchain
COPY ./rust-toolchain ./rust-toolchain
COPY ./build.rs ./build.rs
COPY ./build.rs ./build.rs
{ % if "a arch64 " in target_file %}
{ % if "a rm64v8 " in target_file %}
ENV CC_aarch64_unknown_linux_gnu = "/usr/bin/aarch64-linux-gnu-gcc"
ENV CC_aarch64_unknown_linux_gnu = "/usr/bin/aarch64-linux-gnu-gcc"
ENV CROSS_COMPILE = "1"
ENV CROSS_COMPILE = "1"
ENV OPENSSL_INCLUDE_DIR = "/usr/include/aarch64-linux-gnu"
ENV OPENSSL_INCLUDE_DIR = "/usr/include/aarch64-linux-gnu"
ENV OPENSSL_LIB_DIR = "/usr/lib/aarch64-linux-gnu"
ENV OPENSSL_LIB_DIR = "/usr/lib/aarch64-linux-gnu"
{ % elif "arm v6" in target_file %}
{ % elif "arm 32 v6" in target_file %}
ENV CC_arm_unknown_linux_gnueabi = "/usr/bin/arm-linux-gnueabi-gcc"
ENV CC_arm_unknown_linux_gnueabi = "/usr/bin/arm-linux-gnueabi-gcc"
ENV CROSS_COMPILE = "1"
ENV CROSS_COMPILE = "1"
ENV OPENSSL_INCLUDE_DIR = "/usr/include/arm-linux-gnueabi"
ENV OPENSSL_INCLUDE_DIR = "/usr/include/arm-linux-gnueabi"
ENV OPENSSL_LIB_DIR = "/usr/lib/arm-linux-gnueabi"
ENV OPENSSL_LIB_DIR = "/usr/lib/arm-linux-gnueabi"
{ % elif "arm v7" in target_file %}
{ % elif "arm 32 v7" in target_file %}
ENV CC_armv7_unknown_linux_gnueabihf = "/usr/bin/arm-linux-gnueabihf-gcc"
ENV CC_armv7_unknown_linux_gnueabihf = "/usr/bin/arm-linux-gnueabihf-gcc"
ENV CROSS_COMPILE = "1"
ENV CROSS_COMPILE = "1"
ENV OPENSSL_INCLUDE_DIR = "/usr/include/arm-linux-gnueabihf"
ENV OPENSSL_INCLUDE_DIR = "/usr/include/arm-linux-gnueabihf"
@ -182,13 +170,13 @@ ENV OPENSSL_LIB_DIR="/usr/lib/arm-linux-gnueabihf"
{ % if "alpine" in target_file %}
{ % if "alpine" in target_file %}
RUN rustup target add x86_64-unknown-linux-musl
RUN rustup target add x86_64-unknown-linux-musl
{ % elif "a arch64 " in target_file %}
{ % elif "a rm64v8 " in target_file %}
RUN rustup target add aarch64-unknown-linux-gnu
RUN rustup target add aarch64-unknown-linux-gnu
{ % elif "arm v6" in target_file %}
{ % elif "arm 32 v6" in target_file %}
RUN rustup target add arm-unknown-linux-gnueabi
RUN rustup target add arm-unknown-linux-gnueabi
{ % elif "arm v7" in target_file %}
{ % elif "arm 32 v7" in target_file %}
RUN rustup target add armv7-unknown-linux-gnueabihf
RUN rustup target add armv7-unknown-linux-gnueabihf
{ % endif %}
{ % endif %}
# Builds your dependencies and removes the
# Builds your dependencies and removes the
@ -208,11 +196,11 @@ RUN touch src/main.rs
# your actual source files being built
# your actual source files being built
{ % if "amd64" in target_file %}
{ % if "amd64" in target_file %}
RUN cargo build --features ${ DB } --release
RUN cargo build --features ${ DB } --release
{ % elif "a arch64 " in target_file %}
{ % elif "a rm64v8 " in target_file %}
RUN cargo build --features ${ DB } --release --target= aarch64-unknown-linux-gnu
RUN cargo build --features ${ DB } --release --target= aarch64-unknown-linux-gnu
{ % elif "arm v6" in target_file %}
{ % elif "arm 32 v6" in target_file %}
RUN cargo build --features ${ DB } --release --target= arm-unknown-linux-gnueabi
RUN cargo build --features ${ DB } --release --target= arm-unknown-linux-gnueabi
{ % elif "arm v7" in target_file %}
{ % elif "arm 32 v7" in target_file %}
RUN cargo build --features ${ DB } --release --target= armv7-unknown-linux-gnueabihf
RUN cargo build --features ${ DB } --release --target= armv7-unknown-linux-gnueabihf
{ % endif %}
{ % endif %}
@ -277,11 +265,11 @@ COPY Rocket.toml .
COPY --from= vault /web-vault ./web-vault
COPY --from= vault /web-vault ./web-vault
{ % if "alpine" in target_file %}
{ % if "alpine" in target_file %}
COPY --from= build /app/target/x86_64-unknown-linux-musl/release/bitwarden_rs .
COPY --from= build /app/target/x86_64-unknown-linux-musl/release/bitwarden_rs .
{ % elif "a arch64 " in target_file %}
{ % elif "a rm64v8 " in target_file %}
COPY --from= build /app/target/aarch64-unknown-linux-gnu/release/bitwarden_rs .
COPY --from= build /app/target/aarch64-unknown-linux-gnu/release/bitwarden_rs .
{ % elif "arm v6" in target_file %}
{ % elif "arm 32 v6" in target_file %}
COPY --from= build /app/target/arm-unknown-linux-gnueabi/release/bitwarden_rs .
COPY --from= build /app/target/arm-unknown-linux-gnueabi/release/bitwarden_rs .
{ % elif "arm v7" in target_file %}
{ % elif "arm 32 v7" in target_file %}
COPY --from= build /app/target/armv7-unknown-linux-gnueabihf/release/bitwarden_rs .
COPY --from= build /app/target/armv7-unknown-linux-gnueabihf/release/bitwarden_rs .
{ % else %}
{ % else %}
COPY --from= build app/target/release/bitwarden_rs .
COPY --from= build app/target/release/bitwarden_rs .