summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <faern@faern.net>2022-10-14 15:39:35 +0200
committerLinus Färnstrand <faern@faern.net>2022-10-19 14:58:27 +0200
commitfd7d4878c41375aaf9a81b38c4b330208eb73ee8 (patch)
treeeca698ea402ebc1fc467c470e6fa864eabd9734a
parent0586f14300117d5e22effaeb229316b98330a14f (diff)
downloadmullvadvpn-fd7d4878c41375aaf9a81b38c4b330208eb73ee8.tar.xz
mullvadvpn-fd7d4878c41375aaf9a81b38c4b330208eb73ee8.zip
Allow building the ARM64 installers in the image
-rw-r--r--Dockerfile33
1 files changed, 25 insertions, 8 deletions
diff --git a/Dockerfile b/Dockerfile
index 9270ed53a5..2981d9bd3c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -7,16 +7,18 @@
# dependencies and building everything.
#
# podman run --rm \
-# -v ~/.cargo:/root/.cargo:Z \
+# -v /path/to/container_cache/target:/root/.cargo/target:Z \
+# -v /path/to/container_cache/registry:/root/.cargo/registry:Z \
# -v .:/build:Z \
# mullvadvpn-app-build ./build.sh
+#
+# And add -e TARGETS="aarch64-unknown-linux-gnu" to build for ARM64
# Debian 10 is the oldest supported distro. It has the oldest glibc that we support
FROM debian:10.13-slim@sha256:557ee531b81ce380d012d83b7bb56211572e5d6088d3e21a3caef7d7ed7f718b
# === Define toolchain versions and paths ===
-ENV CARGO_HOME=/root/.cargo
ENV CARGO_TARGET_DIR=/root/.cargo/target
ENV GOLANG_VERSION 1.18.5
@@ -24,19 +26,31 @@ ENV GOLANG_HASH 9e5de37f9c49942c601b191ac5fba404b868bfc21d446d6960acc12283d6e5f2
# === Install/set up the image ===
-RUN apt-get update -y && apt-get install -y \
+RUN dpkg --add-architecture arm64 && apt-get update -y && apt-get install -y \
git \
curl \
- gcc \
- libdbus-1-dev \
+ gcc gcc-aarch64-linux-gnu \
+ libdbus-1-dev libdbus-1-dev:arm64 \
rpm \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*
-# Install latest stable Rust toolchain
-ENV PATH "/root/.cargo/bin:$PATH"
+# === Rust ===
+
+# Install latest stable Rust toolchain for both x86_64-unknown-linux-gnu and aarch64-unknown-linux-gnu
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
- sh -s -- --default-toolchain stable --profile minimal -y
+ sh -s -- --default-toolchain stable --profile minimal --target aarch64-unknown-linux-gnu -y
+
+ENV PATH "/root/.cargo/bin:$PATH"
+
+RUN echo '[target.aarch64-unknown-linux-gnu]\n\
+linker = "aarch64-linux-gnu-gcc"\n\
+\n\
+[target.aarch64-unknown-linux-gnu.dbus]\n\
+rustc-link-search = ["/usr/aarch64-linux-gnu/lib"]\n\
+rustc-link-lib = ["dbus-1"]' > /root/.cargo/config.toml
+
+# === Volta for npm + node ===
ENV PATH /root/.volta/bin:$PATH
# volta seemingly does not have a way to explicitly install the toolchain
@@ -44,6 +58,8 @@ ENV PATH /root/.volta/bin:$PATH
COPY gui/package.json .
RUN curl https://get.volta.sh | bash && node --version && rm package.json
+# === Golang ===
+
# Install golang
# Checksum from: https://go.dev/dl/
RUN curl -Lo go.tgz https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz && \
@@ -52,4 +68,5 @@ RUN curl -Lo go.tgz https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz &&
rm go.tgz
ENV PATH /usr/local/go/bin:$PATH
+
WORKDIR /build