From 2ff713ba3a1ac0b97877960de5af1fad8dcc8dff Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Wed, 1 Dec 2021 17:31:05 -0300 Subject: [PATCH] try building an image for aarch64 --- image/auto_build.rb | 2 +- image/base/Dockerfile | 5 +++-- image/base/install-imagemagick | 32 +++----------------------------- 3 files changed, 7 insertions(+), 32 deletions(-) diff --git a/image/auto_build.rb b/image/auto_build.rb index 814f86e..f3d9655 100644 --- a/image/auto_build.rb +++ b/image/auto_build.rb @@ -30,7 +30,7 @@ def run(command) end def build(image) - lines = run("cd #{image[:name]} && docker build . --no-cache --tag #{image[:tag]} #{image[:squash] ? '--squash' : ''} #{image[:extra_args] ? image[:extra_args] : ''}") + lines = run("cd #{image[:name]} && docker buildx build . --platform linux/arm64 --load --tag #{image[:tag]} #{image[:extra_args] ? image[:extra_args] : ''}") raise "Error building the image for #{image[:name]}: #{lines[-1]}" if lines[-1] =~ /successfully built/ end diff --git a/image/base/Dockerfile b/image/base/Dockerfile index 9a390c3..9d38ce7 100644 --- a/image/base/Dockerfile +++ b/image/base/Dockerfile @@ -1,6 +1,6 @@ # NAME: discourse/base # VERSION: release -FROM debian:buster-slim +FROM debian:bullseye-slim ENV PG_MAJOR 13 ENV RUBY_ALLOCATOR /usr/lib/libjemalloc.so.1 @@ -10,6 +10,7 @@ ENV RAILS_ENV production RUN echo 2.0.`date +%Y%m%d` > /VERSION +RUN echo 'deb http://deb.debian.org/debian bullseye-backports main' > /etc/apt/sources.list.d/bullseye-backports.list RUN apt update && apt install -y gnupg sudo curl RUN echo "debconf debconf/frontend select Teletype" | debconf-set-selections RUN apt update && apt -y install fping @@ -24,7 +25,7 @@ ENV LANG en_US.UTF-8 ENV LANGUAGE en_US.UTF-8 RUN curl https://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add - -RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" | \ +RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" | \ tee /etc/apt/sources.list.d/postgres.list RUN curl --silent --location https://deb.nodesource.com/setup_16.x | sudo bash - RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - diff --git a/image/base/install-imagemagick b/image/base/install-imagemagick index 34f4eb2..3a5dbb3 100755 --- a/image/base/install-imagemagick +++ b/image/base/install-imagemagick @@ -5,13 +5,6 @@ set -e IMAGE_MAGICK_VERSION="7.1.0-6" IMAGE_MAGICK_HASH="0e925a1e6192bf2908bfcf1a99eec271f36844663ab3b6d2690cdaaa11b928c7" -# version check: https://github.com/strukturag/libheif/releases -LIBHEIF_VERSION="1.12.0" -LIBHEIF_HASH="086145b0d990182a033b0011caadb1b642da84f39ab83aa66d005610650b3c65" - -# version check: https://aomedia.googlesource.com/aom -LIB_AOM_VERSION="3.1.3" - # We use debian, but GitHub CI is stuck on Ubuntu Bionic, so this must be compatible with both LIBJPEGTURBO=$(cat /etc/issue | grep -qi Debian && echo 'libjpeg62-turbo libjpeg62-turbo-dev' || echo 'libjpeg-turbo8 libjpeg-turbo8-dev') @@ -26,30 +19,11 @@ apt -y -q install git make gcc pkg-config autoconf curl g++ \ libpng16-16 libpng-dev ${LIBJPEGTURBO} libwebp6 libwebp-dev libgomp1 libwebpmux3 libwebpdemux2 ghostscript libxml2-dev libxml2-utils \ libbz2-dev gsfonts libtiff-dev libfreetype6-dev libjpeg-dev -mkdir -p $WDIR -cd $WDIR +# Use backports instead of compiling it +apt -y -q install -t bullseye-backports libheif1 libaom-dev libheif-dev -# Building libaom -git clone https://aomedia.googlesource.com/aom -cd aom && git checkout v${LIB_AOM_VERSION} && cd .. -mkdir build_aom -cd build_aom -cmake ../aom/ -DENABLE_TESTS=0 -DBUILD_SHARED_LIBS=1 && make && make install -ldconfig /usr/local/lib -cd .. -rm -rf aom -rm -rf build_aom - -# Build and install libheif +mkdir -p $WDIR cd $WDIR -wget -O $WDIR/libheif.tar.gz "https://github.com/strukturag/libheif/archive/v$LIBHEIF_VERSION.tar.gz" -sha256sum $WDIR/libheif.tar.gz -echo "$LIBHEIF_HASH $WDIR/libheif.tar.gz" | sha256sum -c -tar -xzvf $WDIR/libheif.tar.gz -cd libheif-$LIBHEIF_VERSION -./autogen.sh -./configure -make && make install # Build and install ImageMagick wget -O $WDIR/ImageMagick.tar.gz "https://github.com/ImageMagick/ImageMagick/archive/$IMAGE_MAGICK_VERSION.tar.gz" -- 2.25.1