Skip to content

Commit

Permalink
Use Docker bake and quiet apt [10]
Browse files Browse the repository at this point in the history
  • Loading branch information
arBmind committed Dec 15, 2024
1 parent 48c62fa commit e773a2d
Show file tree
Hide file tree
Showing 3 changed files with 357 additions and 206 deletions.
209 changes: 34 additions & 175 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,34 @@ name: Build Docker Images
on: push

jobs:
define-matrix:
runs-on: ubuntu-latest
outputs:
cmake_versions: ${{ steps.matrix.outputs.cmake_versions }}
qts: ${{ steps.matrix.outputs.qts }}
steps:
- name: Define Matrix
id: matrix
run: |
echo 'cmake_versions=["3.30.6", "3.31.2"]' >> "$GITHUB_OUTPUT"
echo 'qts=[{"version": "6.6.3", "arch": "gcc_64"}, {"version": "6.7.3", "arch": "linux_gcc_64"}, {"version": "6.8.1", "arch": "linux_gcc_64"}]' >> "$GITHUB_OUTPUT"
cmake:
name: "CMake Docker builds"
needs: define-matrix
strategy:
fail-fast: false
matrix:
distro: ['noble']
cmake_version: ['3.30.6', '3.31.2']
clang: [
{major: 17, source: 'apt'},
{major: 18, source: 'llvm'},
{major: 19, source: 'llvm'}
]
gcc: [
{major: 12, source: 'apt'},
{major: 13, source: 'apt'},
{major: 14, source: 'apt'}
]
qt: [
{version: '6.6.3', arch: 'gcc_64'},
{version: '6.7.3', arch: 'linux_gcc_64'},
{version: '6.8.1', arch: 'linux_gcc_64'}
]

include:
- distro: noble
cmake_version: '3.31.2'
clang: {major: 19, source: 'llvm'}
gcc: {major: 14, source: 'apt'}
qt: {version: '6.8.1', arch: 'linux_gcc_64'}
gcc_tags: |
arbmind/cmake-gcc:latest
ghcr.io/arbmind/cmake-gcc:latest
gcc_qt_tags: |
arbmind/cmake-gcc-qt:latest
ghcr.io/arbmind/cmake-gcc-qt:latest
gcc_qtgui_tags: |
arbmind/cmake-gcc-qtgui-dev:latest
ghcr.io/arbmind/cmake-gcc-qtgui-dev:latest
clang_tags: |
arbmind/cmake-clang:latest
ghcr.io/arbmind/cmake-clang:latest
clang_libstdcpp_tags: |
arbmind/cmake-clang-libstdcpp:latest
ghcr.io/arbmind/cmake-clang-libstdcpp:latest
clang_libstdcpp_qt_tags: |
arbmind/cmake-clang-libstdcpp-qt:latest
ghcr.io/arbmind/cmake-clang-libstdcpp-qt:latest
clang_libstdcpp_qtgui_tags: |
arbmind/cmake-clang-libstdcpp-qtgui-dev:latest
ghcr.io/arbmind/cmake-clang-libstdcpp-qtgui-dev:latest
cmake_version: ${{ fromJSON(needs.define-matrix.outputs.cmake_versions) }}
qt: ${{ fromJSON(needs.define-matrix.outputs.qts) }}

runs-on: ubuntu-latest
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true

- uses: actions/checkout@v4

- name: Set up Docker Buildx
Expand All @@ -76,136 +51,20 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: CMake ${{ matrix.cmake_version }} + GCC ${{ matrix.gcc.major }}
uses: docker/build-push-action@v6
with:
# buildkitd-flags: --debug
target: cmake-gcc
push: ${{ github.event_name != 'pull_request' }}
tags: |
arbmind/cmake-gcc:${{ matrix.cmake_version }}-${{ matrix.gcc.major }}
ghcr.io/arbmind/cmake-gcc:${{ matrix.cmake_version }}-${{ matrix.gcc.major }}
${{ matrix.gcc_tags }}
build-args: |
DISTRO=${{ matrix.distro }}
GCC_MAJOR=${{ matrix.gcc.major }}
GCC_SOURCE=${{ matrix.gcc.source }}
QT_VERSION=${{ matrix.qt.version }}
QT_ARCH=${{ matrix.qt.arch }}
CMAKE_VERSION=${{ matrix.cmake_version }}
- name: CMake ${{ matrix.cmake_version }} + GCC ${{ matrix.gcc.major }} + Qt ${{ matrix.qt.version }}
uses: docker/build-push-action@v6
with:
target: cmake-gcc-qt
push: ${{ github.event_name != 'pull_request' }}
tags: |
arbmind/cmake-gcc-qt:${{ matrix.cmake_version }}-${{ matrix.gcc.major }}-${{ matrix.qt.version }}
ghcr.io/arbmind/cmake-gcc-qt:${{ matrix.cmake_version }}-${{ matrix.gcc.major }}-${{ matrix.qt.version }}
${{ matrix.gcc_qt_tags }}
build-args: |
DISTRO=${{ matrix.distro }}
GCC_MAJOR=${{ matrix.gcc.major }}
GCC_SOURCE=${{ matrix.gcc.source }}
QT_VERSION=${{ matrix.qt.version }}
QT_ARCH=${{ matrix.qt.arch }}
CMAKE_VERSION=${{ matrix.cmake_version }}
- name: CMake ${{ matrix.cmake_version }} + GCC ${{ matrix.gcc.major }} + QtGui ${{ matrix.qt.version }} + Dev
uses: docker/build-push-action@v6
with:
target: cmake-qtgui-dev
push: ${{ github.event_name != 'pull_request' }}
tags: |
arbmind/cmake-gcc-qtgui-dev:${{ matrix.cmake_version }}-${{ matrix.gcc.major }}-${{ matrix.qt.version }}
ghcr.io/arbmind/cmake-gcc-qtgui-dev:${{ matrix.cmake_version }}-${{ matrix.gcc.major }}-${{ matrix.qt.version }}
${{ matrix.gcc_qtgui_tags }}
labels: |
Description="Ubuntu ${{ matrix.distro }} - Gcc${{ matrix.gcc.major }} + CMake ${{ matrix.cmake_version }} + QtGui ${{ matrix.qt.version }} + Dev"
org.opencontainers.image.source="https://github.com/arBmind/cmake-containers"
build-args: |
DISTRO=${{ matrix.distro }}
GCC_MAJOR=${{ matrix.gcc.major }}
GCC_SOURCE=${{ matrix.gcc.source }}
QT_VERSION=${{ matrix.qt.version }}
QT_ARCH=${{ matrix.qt.arch }}
CMAKE_VERSION=${{ matrix.cmake_version }}
QTGUI_BASE_IMAGE=cmake-gcc-qt
- name: CMake ${{ matrix.cmake_version }} + Clang ${{ matrix.clang.major }}
uses: docker/build-push-action@v6
with:
target: cmake-clang
push: ${{ github.event_name != 'pull_request' }}
tags: |
arbmind/cmake-clang:${{ matrix.cmake_version }}-${{ matrix.clang.major }}
ghcr.io/arbmind/cmake-clang:${{ matrix.cmake_version }}-${{ matrix.clang.major }}
${{ matrix.clang_tags }}
build-args: |
DISTRO=${{ matrix.distro }}
CLANG_MAJOR=${{ matrix.clang.major }}
CLANG_SOURCE=${{ matrix.clang.source }}
QT_VERSION=${{ matrix.qt.version }}
QT_ARCH=${{ matrix.qt.arch }}
CMAKE_VERSION=${{ matrix.cmake_version }}
- name: CMake ${{ matrix.cmake_version }} + Clang ${{ matrix.clang.major }} + LibStdC++ ${{ matrix.gcc.major }}
uses: docker/build-push-action@v6
with:
target: cmake-clang-libstdcpp
push: ${{ github.event_name != 'pull_request' }}
tags: |
arbmind/cmake-clang-libstdcpp:${{ matrix.cmake_version }}-${{ matrix.clang.major }}-${{ matrix.gcc.major }}
ghcr.io/arbmind/cmake-clang-libstdcpp:${{ matrix.cmake_version }}-${{ matrix.clang.major }}-${{ matrix.gcc.major }}
${{ matrix.clang_libstdcpp_tags }}
build-args: |
DISTRO=${{ matrix.distro }}
CLANG_MAJOR=${{ matrix.clang.major }}
CLANG_SOURCE=${{ matrix.clang.source }}
GCC_MAJOR=${{ matrix.gcc.major }}
GCC_SOURCE=${{ matrix.gcc.source }}
QT_VERSION=${{ matrix.qt.version }}
QT_ARCH=${{ matrix.qt.arch }}
CMAKE_VERSION=${{ matrix.cmake_version }}
- name: CMake ${{ matrix.cmake_version }} + Clang ${{ matrix.clang.major }} + LibStdC++ ${{ matrix.gcc.major }} + Qt ${{ matrix.qt.version }}
uses: docker/build-push-action@v6
with:
target: cmake-clang-libstdcpp-qt
push: ${{ github.event_name != 'pull_request' }}
tags: |
arbmind/cmake-clang-libstdcpp-qt:${{ matrix.cmake_version }}-${{ matrix.clang.major }}-${{ matrix.gcc.major }}-${{ matrix.qt.version }}
ghcr.io/arbmind/cmake-clang-libstdcpp-qt:${{ matrix.cmake_version }}-${{ matrix.clang.major }}-${{ matrix.gcc.major }}-${{ matrix.qt.version }}
${{ matrix.clang_libstdcpp_qt_tags }}
build-args: |
DISTRO=${{ matrix.distro }}
CLANG_MAJOR=${{ matrix.clang.major }}
CLANG_SOURCE=${{ matrix.clang.source }}
GCC_MAJOR=${{ matrix.gcc.major }}
GCC_SOURCE=${{ matrix.gcc.source }}
QT_VERSION=${{ matrix.qt.version }}
QT_ARCH=${{ matrix.qt.arch }}
CMAKE_VERSION=${{ matrix.cmake_version }}
- name: Compact JSON
id: compact_step
run: |
echo "qt_json=$(cat <<JSON_EOF | jq -c
${{ toJSON(matrix.qt) }}
JSON_EOF
)" >> "$GITHUB_OUTPUT"
- name: CMake ${{ matrix.cmake_version }} + Clang ${{ matrix.clang.major }} + LibStdC++ ${{ matrix.gcc.major }} + QtGui ${{ matrix.qt.version }} + Dev
uses: docker/build-push-action@v6
- name: Build
uses: docker/bake-action@v5
with:
target: cmake-qtgui-dev
push: ${{ github.event_name != 'pull_request' }}
tags: |
arbmind/cmake-clang-libstdcpp-qtgui-dev:${{ matrix.cmake_version }}-${{ matrix.clang.major }}-${{ matrix.gcc.major }}-${{ matrix.qt.version }}
ghcr.io/arbmind/cmake-clang-libstdcpp-qtgui-dev:${{ matrix.cmake_version }}-${{ matrix.clang.major }}-${{ matrix.gcc.major }}-${{ matrix.qt.version }}
${{ matrix.clang_libstdcpp_qtgui_tags }}
labels: |
Description="Ubuntu ${{ matrix.distro }} - Clang${{ matrix.clang.major }} + Libstdc++-${{ matrix.gcc.major }} + CMake ${{ matrix.cmake_version }} + QtGui ${{ matrix.qt.version }} + Dev"
org.opencontainers.image.source="https://github.com/arBmind/cmake-containers"
build-args: |
DISTRO=${{ matrix.distro }}
CLANG_MAJOR=${{ matrix.clang.major }}
CLANG_SOURCE=${{ matrix.clang.source }}
GCC_MAJOR=${{ matrix.gcc.major }}
GCC_SOURCE=${{ matrix.gcc.source }}
QT_VERSION=${{ matrix.qt.version }}
QT_ARCH=${{ matrix.qt.arch }}
CMAKE_VERSION=${{ matrix.cmake_version }}
QTGUI_BASE_IMAGE=cmake-clang-libstdcpp-qt
env:
CMAKE_VERSION: ${{ matrix.cmake_version }}
CMAKE_VERSIONS: ${{ needs.define-matrix.outputs.cmake_versions }}
QT: ${{ steps.compact_step.outputs.qt_json }}
QTS: ${{ needs.define-matrix.outputs.qts }}
62 changes: 31 additions & 31 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ ARG DEBIAN_FRONTEND=noninteractive
RUN pip install aqtinstall

RUN <<INSTALL_7ZIP
apt update --quiet
apt-get install --yes --quiet --no-install-recommends \
apt-get -qq update -o=Dpkg::Use-Pty=0
apt-get -qq --yes install -o=Dpkg::Use-Pty=0 --no-install-recommends \
p7zip-full \
libglib2.0-0
apt-get --yes autoremove
apt-get clean autoclean
apt-get -qq --yes autoremove -o=Dpkg::Use-Pty=0
apt-get -qq clean autoclean -o=Dpkg::Use-Pty=0
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
INSTALL_7ZIP

Expand All @@ -80,13 +80,13 @@ ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
ARG DEBIAN_FRONTEND=noninteractive

RUN <<INSTALL_WGET
apt-get update --quiet
apt-get upgrade --yes --quiet
apt-get install --yes --quiet --no-install-recommends \
apt-get -qq update -o=Dpkg::Use-Pty=0
apt-get -qq --yes upgrade -o=Dpkg::Use-Pty=0
apt-get -qq --yes install -o=Dpkg::Use-Pty=0 --no-install-recommends \
ca-certificates \
wget
apt-get --yes autoremove
apt-get clean autoclean
apt-get -qq --yes autoremove -o=Dpkg::Use-Pty=0
apt-get -qq clean autoclean -o=Dpkg::Use-Pty=0
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
INSTALL_WGET

Expand All @@ -112,9 +112,9 @@ ENV \

RUN <<INSTALL_GCC
set -e
apt-get update --quiet
apt-get upgrade --yes --quiet
apt-get install --yes --quiet --no-install-recommends \
apt-get -qq update -o=Dpkg::Use-Pty=0
apt-get -qq --yes upgrade -o=Dpkg::Use-Pty=0
apt-get -qq --yes install -o=Dpkg::Use-Pty=0 --no-install-recommends \
libglib2.0-0 \
apt-transport-https \
ca-certificates \
Expand All @@ -123,9 +123,9 @@ RUN <<INSTALL_GCC
if [ "$GCC_SOURCE" = "ppa" ] ; then
wget -qO - "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x60c317803a41ba51845e371a1e9377a2ba9ef27f" | apt-key add -
echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu ${DISTRO} main" > /etc/apt/sources.list.d/gcc.list
apt-get update --quiet
apt-get -qq update -o=Dpkg::Use-Pty=0
fi
apt-get install --yes --quiet --no-install-recommends \
apt-get -qq --yes install -o=Dpkg::Use-Pty=0 --no-install-recommends \
git \
ninja-build \
make \
Expand All @@ -138,8 +138,8 @@ RUN <<INSTALL_GCC
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_MAJOR} 100
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_MAJOR} 100
c++ --version
apt-get --yes autoremove
apt-get clean autoclean
apt-get -qq --yes autoremove -o=Dpkg::Use-Pty=0
apt-get -qq clean autoclean -o=Dpkg::Use-Pty=0
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
INSTALL_GCC

Expand Down Expand Up @@ -195,9 +195,9 @@ ENV \

# install Clang (https://apt.llvm.org/)
RUN <<INSTALL_CLANG
apt-get update --quiet
apt-get upgrade --yes --quiet
apt-get install --yes --quiet --no-install-recommends \
apt-get -qq update -o=Dpkg::Use-Pty=0
apt-get -qq --yes upgrade -o=Dpkg::Use-Pty=0
apt-get -qq --yes install -o=Dpkg::Use-Pty=0 --no-install-recommends \
libglib2.0-0 \
wget \
gnupg \
Expand All @@ -206,9 +206,9 @@ RUN <<INSTALL_CLANG
if [ "$CLANG_SOURCE" = "llvm" ] ; then
wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
echo "deb http://apt.llvm.org/${DISTRO}/ llvm-toolchain-${DISTRO}-${CLANG_MAJOR} main" > /etc/apt/sources.list.d/llvm.list
apt-get update --quiet
apt-get -qq update -o=Dpkg::Use-Pty=0
fi
apt-get install --yes --quiet --no-install-recommends \
apt-get -qq --yes install -o=Dpkg::Use-Pty=0 --no-install-recommends \
git \
ninja-build \
make \
Expand All @@ -226,8 +226,8 @@ RUN <<INSTALL_CLANG
update-alternatives --install /usr/bin/ld ld /usr/bin/ld.gold 20
update-alternatives --install /usr/bin/ld ld /usr/bin/ld.bfd 30
c++ --version
apt-get --yes autoremove
apt-get clean autoclean
apt-get -qq --yes autoremove -o=Dpkg::Use-Pty=0
apt-get -qq clean autoclean -o=Dpkg::Use-Pty=0
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
INSTALL_CLANG

Expand Down Expand Up @@ -282,12 +282,12 @@ RUN <<INSTALL_LIBSTDCPP
if [ "$GCC_SOURCE" = "ppa" ] ; then
wget -qO - "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x60c317803a41ba51845e371a1e9377a2ba9ef27f" | apt-key add -
echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu ${DISTRO} main" > /etc/apt/sources.list.d/gcc.list
apt-get update --quiet
apt-get -qq update -o=Dpkg::Use-Pty=0
fi
apt-get install --yes --quiet --no-install-recommends \
apt-get -qq --yes install -o=Dpkg::Use-Pty=0 --no-install-recommends \
libstdc++-${GCC_MAJOR}-dev
apt-get --yes autoremove
apt-get clean autoclean
apt-get -qq --yes autoremove -o=Dpkg::Use-Pty=0
apt-get -qq clean autoclean -o=Dpkg::Use-Pty=0
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
INSTALL_LIBSTDCPP

Expand Down Expand Up @@ -335,11 +335,11 @@ FROM ${QTGUI_BASE_IMAGE} AS cmake-qtgui-dev
ARG QTGUI_PACKAGES

RUN <<INSTALL_QTGUI_PACKAGES
apt update --quiet
apt-get install --yes --quiet --no-install-recommends \
apt-get -qq update -o=Dpkg::Use-Pty=0
apt-get -qq --yes install -o=Dpkg::Use-Pty=0 --no-install-recommends \
${QTGUI_PACKAGES} \
gdb
apt-get --yes autoremove
apt-get clean autoclean
apt-get -qq --yes autoremove -o=Dpkg::Use-Pty=0
apt-get -qq clean autoclean -o=Dpkg::Use-Pty=0
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
INSTALL_QTGUI_PACKAGES
Loading

0 comments on commit e773a2d

Please sign in to comment.