Skip to content

Commit ff5b7b4

Browse files
Enable caching when building CentOS container (#656)
Fixes #649 Move the Linux CI build container setup from inline docker exec commands into a dedicated Dockerfile (`.github/ci-build/Dockerfile`) and use `docker/build-push-action` with GitHub Actions cache (`type=gha`) to cache the Docker image layers. This avoids reinstalling the toolchain (`devtoolset`, `bison`, `ninja`, etc.) on every CI run, speeding up the Linux build steps. --------- Co-authored-by: Adam Reeve <adam.reeve@gr-oss.io>
1 parent 82991cb commit ff5b7b4

2 files changed

Lines changed: 42 additions & 10 deletions

File tree

.github/ci-build/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ARG MANYLINUX_ARCH=x86_64
2+
FROM quay.io/pypa/manylinux2014_${MANYLINUX_ARCH}
3+
4+
ARG BISON_VERSION=3.8.2
5+
6+
RUN yum install -y \
7+
devtoolset-10 \
8+
rh-git227 \
9+
httpd24-curl \
10+
flex \
11+
perl-Data-Dumper \
12+
perl-IPC-Cmd \
13+
perl-Time-Piece \
14+
&& yum clean all \
15+
&& rm -rf /var/cache/yum
16+
17+
RUN uv tool install ninja
18+
19+
RUN curl -L -o /tmp/bison-${BISON_VERSION}.tar.gz \
20+
https://ftp.gnu.org/gnu/bison/bison-${BISON_VERSION}.tar.gz \
21+
&& tar -xf /tmp/bison-${BISON_VERSION}.tar.gz -C /tmp \
22+
&& cd /tmp/bison-${BISON_VERSION} \
23+
&& ./configure && make && make install \
24+
&& rm -rf /tmp/bison-${BISON_VERSION}*

.github/workflows/ci.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,27 @@ jobs:
111111
./bootstrap-vcpkg.bat
112112
113113
# Setup a CentOS 7 container to build on Linux for backwards compatibility.
114-
- name: Start CentOS container and install toolchain
114+
# We are using Docker layer caching to avoid rebuilding on every CI run.
115+
- name: Set up Docker Buildx
116+
if: runner.os == 'Linux'
117+
uses: docker/setup-buildx-action@v4
118+
- name: Build CI container image
119+
if: runner.os == 'Linux'
120+
uses: docker/build-push-action@v7
121+
with:
122+
file: .github/ci-build/Dockerfile
123+
context: .github/ci-build
124+
build-args: MANYLINUX_ARCH=${{ matrix.arch == 'arm64' && 'aarch64' || 'x86_64' }}
125+
load: true
126+
tags: manylinux2014-parquetsharp-ci-build:latest
127+
cache-from: type=gha,scope=ci-build-${{ matrix.arch }}
128+
cache-to: type=gha,scope=ci-build-${{ matrix.arch }},mode=max
129+
- name: Start CI build container
115130
if: runner.os == 'Linux'
116-
env:
117-
BISON_VERSION: 3.8.2
118131
run: |
119132
docker run -d --name centos --entrypoint tail --net host \
120-
-v $PWD:$PWD -v $VCPKG_INSTALLATION_ROOT:$VCPKG_INSTALLATION_ROOT\
121-
quay.io/pypa/manylinux2014_$(uname -m) -f /dev/null
122-
docker exec centos sh -c "yum install -y devtoolset-10 rh-git227 httpd24-curl flex perl-Data-Dumper perl-IPC-Cmd perl-Time-Piece && \
123-
uv tool install ninja &&
124-
curl -L -o /tmp/bison-${BISON_VERSION}.tar.gz https://ftp.gnu.org/gnu/bison/bison-${BISON_VERSION}.tar.gz &&
125-
tar -xf /tmp/bison-${BISON_VERSION}.tar.gz -C /tmp &&
126-
cd /tmp/bison-${BISON_VERSION} && ./configure && make && make install"
133+
-v $PWD:$PWD -v $VCPKG_INSTALLATION_ROOT:$VCPKG_INSTALLATION_ROOT \
134+
manylinux2014-parquetsharp-ci-build:latest -f /dev/null
127135
128136
# Install vcpkg dependencies
129137
- name: Install vcpkg build dependencies (macOS)

0 commit comments

Comments
 (0)