summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <faern@faern.net>2022-09-29 17:45:28 +0200
committerLinus Färnstrand <faern@faern.net>2022-10-19 10:51:10 +0200
commit0586f14300117d5e22effaeb229316b98330a14f (patch)
tree20ee53dff6ff4b0fd9ed1b8a472f522065442c6e
parente92d267f007056523096cf50cbd2d6d878633726 (diff)
downloadmullvadvpn-0586f14300117d5e22effaeb229316b98330a14f.tar.xz
mullvadvpn-0586f14300117d5e22effaeb229316b98330a14f.zip
Update Dockerfile in the root to be able to build desktop installers
-rw-r--r--.dockerignore1
-rw-r--r--Dockerfile74
2 files changed, 49 insertions, 26 deletions
diff --git a/.dockerignore b/.dockerignore
index 91224e5de8..2e2b5de53b 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1 +1,2 @@
**/*
+!gui/package.json
diff --git a/Dockerfile b/Dockerfile
index c9dc12294c..9270ed53a5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,33 +1,55 @@
# To build the image:
-# docker build . -t quay.io/mullvad/mullvadvpn-app-build
-# To push the image to Quay.io:
-# docker push quay.io/mullvad/mullvadvpn-app-build
-FROM debian:stretch@sha256:a5934d79acb9d1182ef5c747e23e462784f6345479e33b40c979fbe8dce5db40
-RUN apt update -y && apt install build-essential \
- gcc \
- libdbus-1-dev \
- rpm \
- binutils \
- curl \
- p7zip-full \
- git -y
+# podman build . -t mullvadvpn-app-build
+#
+# To run the image and build the app you need to mount the app's source directory into the
+# container. You also probably want to mount in a directory for CARGO_HOME, so each container
+# does not need to start from scratch with cloning the crates.io index, download all
+# dependencies and building everything.
+#
+# podman run --rm \
+# -v ~/.cargo:/root/.cargo:Z \
+# -v .:/build:Z \
+# mullvadvpn-app-build ./build.sh
+# 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
-# Install golang
ENV GOLANG_VERSION 1.18.5
-# Checksum from: https://go.dev/dl/
ENV GOLANG_HASH 9e5de37f9c49942c601b191ac5fba404b868bfc21d446d6960acc12283d6e5f2
-RUN curl -Lo go.tgz https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz && \
- echo $(sha256sum go.tgz) && \
- echo "${GOLANG_HASH} go.tgz" | sha256sum -c - && \
- tar -C /usr/local -xzf go.tgz && \
- rm go.tgz && \
- rm -rf /var/lib/apt/lists/*
-ENV GOPATH /go
-ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
-RUN go version
-RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
+# === Install/set up the image ===
+
+RUN apt-get update -y && apt-get install -y \
+ git \
+ curl \
+ gcc \
+ libdbus-1-dev \
+ rpm \
+ protobuf-compiler \
+ && rm -rf /var/lib/apt/lists/*
+
+# Install latest stable Rust toolchain
+ENV PATH "/root/.cargo/bin:$PATH"
+RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
+ sh -s -- --default-toolchain stable --profile minimal -y
+
+ENV PATH /root/.volta/bin:$PATH
+# volta seemingly does not have a way to explicitly install the toolchain
+# versions from package.json, but `node --version` triggers an install
+COPY gui/package.json .
+RUN curl https://get.volta.sh | bash && node --version && rm package.json
+
+# Install golang
+# Checksum from: https://go.dev/dl/
+RUN curl -Lo go.tgz https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz && \
+ echo "${GOLANG_HASH} go.tgz" | sha256sum -c - && \
+ tar -C /usr/local -xzf go.tgz && \
+ rm go.tgz
+ENV PATH /usr/local/go/bin:$PATH
-RUN mkdir /mvd
-CMD tail -f /dev/null
+WORKDIR /build