From a29a033a5761b4151163af463b4dff272c0f53d8 Mon Sep 17 00:00:00 2001 From: Daiki Mizukami Date: Mon, 24 Jul 2023 18:14:57 +0900 Subject: [PATCH] CI: Update `Dockerfile` to install OpenSSL 3 The custom container is no longer required since the upstream image has removed (the old version of) OpenSSL entirely. --- .github/workflows/build-containers.yml | 9 +++--- docker/aarch64-unknown-linux-gnu/Dockerfile | 10 ++---- .../armv7-unknown-linux-gnueabihf/Dockerfile | 10 ++---- docker/install_packages.sh | 31 +++++++++++++++++++ 4 files changed, 42 insertions(+), 18 deletions(-) create mode 100755 docker/install_packages.sh diff --git a/.github/workflows/build-containers.yml b/.github/workflows/build-containers.yml index 8f3afec..d572610 100644 --- a/.github/workflows/build-containers.yml +++ b/.github/workflows/build-containers.yml @@ -12,16 +12,17 @@ jobs: - aarch64-unknown-linux-gnu - armv7-unknown-linux-gnueabihf steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Log into registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v4 with: - context: docker/${{ matrix.target }} + context: docker + file: docker/${{ matrix.target }}/Dockerfile push: true tags: ghcr.io/tesaguri/pipitor/cross:${{ matrix.target }} diff --git a/docker/aarch64-unknown-linux-gnu/Dockerfile b/docker/aarch64-unknown-linux-gnu/Dockerfile index a8d053d..69314f4 100644 --- a/docker/aarch64-unknown-linux-gnu/Dockerfile +++ b/docker/aarch64-unknown-linux-gnu/Dockerfile @@ -1,8 +1,4 @@ -FROM ghcr.io/tesaguri/cross:aarch64-unknown-linux-gnu +FROM ghcr.io/cross-rs/aarch64-unknown-linux-gnu:latest -RUN dpkg --add-architecture arm64 && \ - apt-get update && \ - apt-get install --assume-yes libsqlite3-dev libsqlite3-dev:arm64 libssl-dev:arm64 - -ENV PKG_CONFIG_ALLOW_CROSS_aarch64_unknown_linux_gnu=1 \ - PKG_CONFIG_PATH_aarch64_unknown_linux_gnu='/usr/lib/aarch64-linux-gnu/pkgconfig' +COPY install_packages.sh / +RUN /install_packages.sh arm64 diff --git a/docker/armv7-unknown-linux-gnueabihf/Dockerfile b/docker/armv7-unknown-linux-gnueabihf/Dockerfile index 287ea4b..93e1552 100644 --- a/docker/armv7-unknown-linux-gnueabihf/Dockerfile +++ b/docker/armv7-unknown-linux-gnueabihf/Dockerfile @@ -1,8 +1,4 @@ -FROM ghcr.io/tesaguri/cross:armv7-unknown-linux-gnueabihf +FROM ghcr.io/cross-rs/armv7-unknown-linux-gnueabihf:latest -RUN dpkg --add-architecture armhf && \ - apt-get update && \ - apt-get install --assume-yes libsqlite3-dev libsqlite3-dev:armhf libssl-dev:armhf - -ENV PKG_CONFIG_ALLOW_CROSS_armv7_unknown_linux_gnueabihf=1 \ - PKG_CONFIG_PATH_armv7_unknown_linux_gnueabihf='/usr/lib/arm-linux-gnueabihf/pkgconfig' +COPY install_packages.sh / +RUN /install_packages.sh armhf diff --git a/docker/install_packages.sh b/docker/install_packages.sh new file mode 100755 index 0000000..b3335df --- /dev/null +++ b/docker/install_packages.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -xeo pipefail + +dpkg --add-architecture "$1" + +if grep -Eq '^UBUNTU_CODENAME=focal$' /etc/os-release; then + # Use `libssl3` package from Ubuntu 22.04 (jammy) since 20.04 (focal) doesn't have the package. + # + echo 'APT::Default-Release "focal";' > /etc/apt/apt.conf.d/01ubuntu + awk '($1$3$4=="debfocalmain"){$3="jammy" ;print}' /etc/apt/sources.list \ + > /etc/apt/sources.list.d/jammy.list + cat /etc/apt/sources.list.d/jammy.list + cat <<-EOF > /etc/apt/preferences.d/libssl3 + Package: libssl3 + Pin: release n=jammy + Pin-Priority: 900 + EOF + cat <<-EOF > /etc/apt/preferences.d/libssl-dev + Package: libssl-dev + Pin: release n=jammy + Pin-Priority: 900 + EOF +fi + +apt-get update +apt-get install --assume-yes --no-install-recommends \ + libsqlite3-dev \ + libsqlite3-dev:"$1" \ + libssl3:"$1" \ + libssl-dev:"$1"