From 2efb1b2667455a2d209cdfc779cdd4fa2dce1fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 23 Nov 2021 08:33:48 +0100 Subject: [PATCH] build: Use tmpfs for cargo cache That seems to workaround https://github.com/rust-lang/cargo/issues/8719. --- .github/bin/get-buildx-args | 4 ++++ Dockerfile | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/bin/get-buildx-args b/.github/bin/get-buildx-args index 8e88c7e15..2dc2da7c9 100755 --- a/.github/bin/get-buildx-args +++ b/.github/bin/get-buildx-args @@ -16,6 +16,10 @@ if [ "$1" != "publish" ] ; then echo --cache-to "type=local,dest=/tmp/.buildx-cache/$MATRIX_ARCHITECTURE" fi +# Workaround for https://github.com/rust-lang/cargo/issues/8719, +# see Dockerfile as well +echo --allow security.insecure + if [ "$1" = "load" ] ; then # Ommit list of platforms loading, see https://github.com/docker/buildx/issues/59 echo --output=type=docker diff --git a/Dockerfile b/Dockerfile index e0269a248..e2de22563 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,10 @@ FROM debian:bullseye-20211115-slim ENV VERSION 4.9.1 ARG TARGETARCH +# Workaround for https://github.com/rust-lang/cargo/issues/8719, +# see below in the Dockerfile and .github/bin/get-buildx-args as well +# syntax = docker/dockerfile:experimental + LABEL name="Weblate" LABEL version=$VERSION LABEL maintainer="Michal Čihař " @@ -46,6 +50,10 @@ ENV PYTHONUNBUFFERED=1 COPY requirements.txt patches /usr/src/weblate/ +# Workaround for https://github.com/rust-lang/cargo/issues/8719, +# see top Dockerfile and .github/bin/get-buildx-args as well +RUN mkdir -p /root/.cargo && chmod 777 /root/.cargo && mount -t tmpfs none /root/.cargo + # Install dependencies # hadolint ignore=DL3008,DL3013,SC2046 RUN \ @@ -110,11 +118,6 @@ RUN \ fi \ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ && source $HOME/.cargo/env \ - # Handle an extremely specific issue when building the cryptography package for \ - # 32-bit architectures within QEMU running on a 64-bit host (issue #30). \ - && if [ "${BUILDX_QEMU_ENV}" = "true" -a "$(getconf LONG_BIT)" = "32" ] ; then \ - sed -i s/^cryptography==/cryptography==3.3.2/ /usr/src/weblate/requirements.txt ; \ - fi \ && python3 -m pip install --no-cache-dir --upgrade $(grep -E '^(pip|wheel|setuptools)==' /usr/src/weblate/requirements.txt) \ && python3 -m pip install --no-cache-dir --no-binary :all: $(grep ^cffi== /usr/src/weblate/requirements.txt) \ && case "$VERSION" in \ @@ -159,7 +162,8 @@ RUN \ && apt-get -y autoremove \ && apt-get clean \ && rustup self uninstall -y \ - && rm -rf /root/.cache /tmp/* /var/lib/apt/lists/* + && rm -rf /root/.cache /tmp/* /var/lib/apt/lists/* \ + && umount /root/.cargo && rmdir /root/.cargo # Apply hotfixes on Weblate RUN find /usr/src/weblate -name '*.patch' -print0 | sort -z | \