diff options
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | docker/Dockerfile | 28 | ||||
-rw-r--r-- | docker/Makefile | 13 | ||||
-rwxr-xr-x | docker/builder.sh | 13 |
4 files changed, 52 insertions, 9 deletions
@@ -127,7 +127,12 @@ build_all_providers: # packaging templates ######################################################################### -prepare: prepare_templates gen_pkg_win gen_pkg_osx gen_pkg_snap gen_pkg_deb prepare_done +prepare: re_vendor prepare_templates gen_pkg_win gen_pkg_osx gen_pkg_snap gen_pkg_deb prepare_done + +re_vendor: + # we update the module vendoring in case we're building with a different + # go version than in development + @go mod vendor prepare_templates: generate relink_default tgz @mkdir -p build/${PROVIDER}/bin/ deploy diff --git a/docker/Dockerfile b/docker/Dockerfile index e9d3bc1..b0645e4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -8,25 +8,27 @@ FROM ubuntu:18.04 as builder MAINTAINER LEAP Encryption Access Project <info@leap.se> LABEL Description="An image to build Bitmask Lite" Vendor="LEAP" Version="1.2" ENV OSXSDK_SHA256="631b4144c6bf75bf7a4d480d685a9b5bda10ee8d03dbf0db829391e2ef858789" \ - PATH="$PATH:/osxcross/target/bin:/usr/lib/go-1.12/bin" + PATH="$PATH:/osxcross/target/bin:/usr/lib/go-1.14/bin" -RUN apt-get update && apt-get upgrade -y && \ - apt-get install -y --no-install-recommends \ +RUN apt-get update && apt-get upgrade --yes && \ + apt-get install --yes --no-install-recommends \ build-essential \ make cmake \ git curl wget \ libappindicator3-dev libgtk-3-dev \ webkit2gtk-4.0 \ - mingw-w64 upx-ucl python snapcraft \ + mingw-w64 upx-ucl python snapcraft snapd \ unzip \ devscripts fakeroot debhelper \ clang llvm-dev libxml2-dev uuid-dev \ libssl-dev bash patch tar \ xz-utils bzip2 gzip sed cpio libbz2-dev \ - software-properties-common dh-golang && \ + software-properties-common dh-golang \ + jq \ + squashfs-tools && \ add-apt-repository -y ppa:longsleep/golang-backports && \ apt-get update && \ - apt-get install -y --no-install-recommends golang-1.12-go golang-golang-x-tools-dev && \ + apt-get install -y --no-install-recommends golang-1.14-go golang-go golang-golang-x-tools-dev && \ rm -r /var/lib/apt/lists/* # version in 18.04 (bionic) is too old @@ -58,6 +60,12 @@ RUN git clone https://github.com/VantaInc/xar && \ ./autogen.sh && ./configure && \ make && sudo make install +# Grab the core18 snap (which snapcraft uses as a base) from the stable channel +# and unpack it in the proper place, to speed up snapcraft builds in the containers. +RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core18' | jq '.download_url' -r) --output core18.snap +RUN mkdir -p /snap/core18 +RUN unsquashfs -d /snap/core18/current core18.snap + # cache go modules RUN rm -rf /gomods && mkdir -p /gomods/packages WORKDIR /gomods @@ -66,3 +74,11 @@ COPY mods/packages/ /gomods/packages/ RUN go mod download COPY builder.sh / + +# Generate locale. +RUN apt-get update && apt-get dist-upgrade --yes && apt-get install --yes sudo locales && locale-gen en_US.UTF-8 + +# Set the proper environment. +ENV LANG="en_US.UTF-8" +ENV LANGUAGE="en_US:en" +ENV LC_ALL="en_US.UTF-8" diff --git a/docker/Makefile b/docker/Makefile index 5fd5121..d2bc1f2 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -16,7 +16,7 @@ UNINSTALLER_SIGNED="../build/windows/staging/uninstall-signed.exe" SIGNCODE=osslsigncode SECRETS="leap/secrets/windoze" -build: +build: mkdir -p mods && cp ../go.mod ../go.sum mods/ && cp -r ../packages mods/ docker build -t $(REGISTRY)/$(IMAGE):latest . deps: @@ -28,6 +28,17 @@ prune: login: docker login $(REGISTRY) +package_snap: + docker run \ + -e PROVIDER=$(PROVIDER) \ + -e TYPE=snap \ + -v `python3 -c 'import os; print(os.path.abspath(".."))'`:/bitmask-vpn.host \ + --cpus="4" \ + -it --rm \ + $(REGISTRY)/$(IMAGE):latest \ + /builder.sh + + package_win: clean_win package_win_stage_1 sign_win_uninstaller_in_host package_win_stage_2 sign_win_installer_in_host clean_win: diff --git a/docker/builder.sh b/docker/builder.sh index a7a2a40..f9577f3 100755 --- a/docker/builder.sh +++ b/docker/builder.sh @@ -7,7 +7,15 @@ rm -rf "${GUESTDIR}" cp -r "${HOSTDIR}" "${GUESTDIR}" cd "${GUESTDIR}" make prepare -make build +case $TYPE in + snap) + echo "[+] Building SNAP" + make package_snap + ;; + default) + make build + ;; +esac case $XBUILD in win) if [ "$STAGE" = "1" ]; then @@ -29,5 +37,8 @@ case $XBUILD in yes) make packages ;; + default) + echo "no XBUILD set..." + ;; esac cp "${GUESTDIR}"/deploy/* $DESTDIR |