Skip to content

Commit 8e6b49e

Browse files
committedFeb 12, 2024
CMake 3.28.1 for Debian and Ubuntu
Cache Docker layers
1 parent a9f1e89 commit 8e6b49e

File tree

4 files changed

+63
-22
lines changed

4 files changed

+63
-22
lines changed
 

‎.github/workflows/package.yml

+23-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ jobs:
7373
username: ${{ github.actor }}
7474
password: ${{ secrets.DOCKER_CI }}
7575

76+
- name: Cache docker layers
77+
uses: actions/cache@v4
78+
with:
79+
path: /tmp/.buildx-cache
80+
key: ${{ github.ref }}-${{ github.sha }}
81+
restore-keys: |
82+
${{ github.ref }}-${{ github.sha }}
83+
${{ github.ref }}
84+
refs/head/main
85+
7686
- name: 🐳 Set up Docker metadata
7787
id: docker_metadata
7888
uses: docker/metadata-action@v5
@@ -90,6 +100,8 @@ jobs:
90100
org.opencontainers.image.source=${{ github.server_url }}/hyperion.docker-ci
91101
org.opencontainers.image.documentation=https://docs.hyperion-project.org/
92102
org.opencontainers.image.licenses=MIT
103+
cache-from: type=local,src=/tmp/.buildx-cache
104+
cache-to: type=local,dest=/tmp/.buildx-cache
93105

94106
- name: 👷 Build and 🚀 Push to GitHub Container/Package Registry
95107
uses: docker/build-push-action@v5
@@ -141,10 +153,20 @@ jobs:
141153
- name: 🐳 Set up Docker Buildx
142154
uses: docker/setup-buildx-action@v3
143155

156+
- name: Cache docker layers
157+
uses: actions/cache@v4
158+
with:
159+
path: /tmp/.buildx-cache
160+
key: ${{ github.ref }}-${{ github.sha }}
161+
restore-keys: |
162+
${{ github.ref }}-${{ github.sha }}
163+
${{ github.ref }}
164+
refs/head/main
165+
144166
- name: 👷 Build, 🔀 Combine and 🚀 Push to GitHub Container/Package Registry
145167
run: |
146168
echo ${{ secrets.DOCKER_CI }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
147-
docker buildx build --provenance=false --push --build-arg SUITE=${{ matrix.os.codename }} --build-arg QT_VERSION=${{ matrix.qt_version }} --platform=linux/arm/v6 --tag ghcr.io/${{ env.REPOSITORY }}/debian:${{ env.IMAGE }}-armv6 --file debian-armv6 .
169+
docker buildx build --provenance=false --push --cache-to type=local,dest=/tmp/.buildx-cache --cache-from type=local,src=/tmp/.buildx-cache --build-arg SUITE=${{ matrix.os.codename }} --build-arg QT_VERSION=${{ matrix.qt_version }} --platform=linux/arm/v6 --tag ghcr.io/${{ env.REPOSITORY }}/debian:${{ env.IMAGE }}-armv6 --file debian-armv6 .
148170
docker buildx imagetools create -t ghcr.io/${{ env.REPOSITORY }}/debian:${{ env.IMAGE }} --append ghcr.io/${{ env.REPOSITORY }}/debian:${{ env.IMAGE }}-armv6
149171
env:
150172
IMAGE: ${{ matrix.qt_version == '6' && format('{0}-qt6', matrix.os.codename) || matrix.os.codename }}

‎README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# Docker Hyperion compilation
22
[![Docker CI](https://github.com/Hyperion-Project/hyperion.docker-ci/workflows/Docker%20CI/badge.svg)](https://github.com/orgs/hyperion-project/packages)<br>
33
Provides multi platform images to compile Hyperion inside a Docker container.<br>
4-
Images are available at https://github.com/orgs/hyperion-project/packages
5-
6-
# TODO
4+
Images are available at https://github.com/orgs/hyperion-project/packages

‎debian-armv6

+15-6
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,21 @@ RUN $APT_INSTALL \
6060
libraspberrypi-dev \
6161
libglib2.0-dev
6262

63-
# downgrade cmake on buster
64-
RUN if [ "$SUITE" = "buster" ]; then \
65-
$APT_UPDATE && $APT_INSTALL cmake=3.13.4-1 cmake-data=3.13.4-1; \
66-
else \
67-
$APT_INSTALL cmake; \
68-
fi
63+
# compile and install cmake
64+
ENV CMAKE_VERSION="3.28.1"
65+
ENV CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}"
66+
RUN set -xe \
67+
&& mkdir -p /tmp/cmake \
68+
&& cd /tmp/cmake \
69+
&& curl -kL ${CMAKE_URL}.tar.gz | tar zxf - -C . --strip-components 1 \
70+
&& ./bootstrap --prefix=/usr/local \
71+
&& make -j $(nproc) \
72+
&& make install \
73+
&& cd \
74+
&& rm -rf /tmp/cmake
75+
76+
# Show cmake version
77+
RUN cmake --version
6978

7079
# download qemu and set exec flag
7180
RUN curl -kL https://github.com/balena-io/qemu/releases/download/v7.0.0%2Bbalena1/qemu-7.0.0.balena1-arm.tar.gz | tar zxvf - -C . --strip-components 1 && mv qemu-arm-static /usr/bin/qemu-static && chmod +x /usr/bin/qemu-static

‎ubuntu_debian

+24-12
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,33 @@ RUN $APT_INSTALL \
7171
libssl-dev \
7272
libglib2.0-dev
7373

74-
# install cmake
75-
# - on debian buster from buster-backports
76-
# - on ubuntu focal (armhf) from ubuntu bionic
77-
RUN if [ "$SUITE" = "buster" ]; then \
78-
echo "deb http://deb.debian.org/debian buster-backports main contrib non-free" > /etc/apt/sources.list.d/buster-backports-sources.list; \
79-
$APT_UPDATE && $APT_INSTALL -t buster-backports cmake; \
80-
rm /etc/apt/sources.list.d/buster-backports-sources.list; \
81-
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ] && [ "$SUITE" = "focal" ]; then \
82-
echo "deb [arch=armhf] http://ports.ubuntu.com/ bionic main restricted" > /etc/apt/sources.list.d/bionic-sources.list; \
83-
$APT_UPDATE && $APT_INSTALL -t bionic cmake; \
84-
rm /etc/apt/sources.list.d/bionic-sources.list; \
74+
# Install cmake on amd64 and arm64
75+
# Compile and install cmake on armv7
76+
ENV CMAKE_VERSION="3.28.1"
77+
ENV CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}"
78+
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
79+
curl -OLs ${CMAKE_URL}-linux-x86_64.sh; \
80+
chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh; \
81+
./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix="/usr"; \
82+
rm -rf cmake-${CMAKE_VERSION}-linux-x86_64.sh; \
83+
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
84+
curl -OLs ${CMAKE_URL}-linux-aarch64.sh; \
85+
chmod +x cmake-${CMAKE_VERSION}-linux-aarch64.sh; \
86+
./cmake-${CMAKE_VERSION}-linux-aarch64.sh --skip-license --prefix="/usr"; \
87+
rm -rf cmake-${CMAKE_VERSION}-linux-aarch64.sh; \
8588
else \
86-
$APT_INSTALL cmake; \
89+
mkdir -p /tmp/cmake; \
90+
cd /tmp/cmake; \
91+
curl -kL ${CMAKE_URL}.tar.gz | tar zxf - -C . --strip-components 1; \
92+
./bootstrap --prefix=/usr/local; \
93+
make -j $(nproc); \
94+
make install; \
95+
cd && rm -rf /tmp/cmake; \
8796
fi
8897

98+
# Show cmake version
99+
RUN cmake --version
100+
89101
# install X11/XCB on Ubuntu for all arch and on Debian for amd64
90102
# install libraspberrypi-dev on Debian for arm64/armhf
91103
RUN if [ "$DIST" = "ubuntu" ] || [ "$TARGETPLATFORM" = "linux/amd64" ]; then \

0 commit comments

Comments
 (0)
Please sign in to comment.