Skip to content

Commit 662c230

Browse files
authored
Build images on dedicated runners (#578)
Docker build was recently failing because building an image for the ARM64 CPU on an AMD64 runner was prohibitively slow. In this PR, we build each image on a dedicated runner matching the target platform. In a following one, we will merge the two images and push them under an unified tag.
1 parent 7d94470 commit 662c230

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

.github/workflows/docker.yaml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,38 +15,53 @@ on:
1515
jobs:
1616
docker:
1717
name: Build Docker
18-
runs-on: ubuntu-24.04
1918
strategy:
2019
matrix:
2120
postgres: ["14", "15", "16", "17"]
21+
runner: ["ubuntu-24.04", "ubuntu-24.04-arm"]
2222

23+
runs-on: ${{ matrix.runner }}
24+
25+
env:
26+
BUILDKIT_PROGRESS: plain
27+
POSTGRES_VERSION: ${{ matrix.postgres }}
2328
steps:
2429
- name: Login to Docker Hub
2530
uses: docker/login-action@v3
2631
with:
2732
username: pgduckdb
2833
password: ${{ secrets.DOCKERHUB_TOKEN }}
34+
2935
- name: Checkout pg_duckdb extension code
3036
uses: actions/checkout@v4
3137
with:
3238
submodules: "recursive"
33-
- name: Set env
39+
- name: Compute platform
40+
id: compute_platform
3441
run: |
35-
echo "POSTGRES_VERSION=${{ matrix.postgres }}" >> $GITHUB_ENV
42+
# Set platform depending on which runner we're using
43+
if [ "${{ matrix.runner }}" = "ubuntu-24.04" ]; then
44+
echo "platform=amd64" >> "$GITHUB_OUTPUT"
45+
else
46+
echo "platform=arm64" >> "$GITHUB_OUTPUT"
47+
fi
48+
3649
- name: Set up QEMU
3750
uses: docker/setup-qemu-action@v3
51+
3852
- name: Set up Docker buildx
3953
uses: docker/setup-buildx-action@v3
4054
with:
41-
platforms: linux/amd64,linux/arm64
55+
platforms: linux/${{ steps.compute_platform.outputs.platform }}
56+
4257
- name: docker bake
4358
uses: docker/bake-action@v5
4459
with:
4560
targets: pg_duckdb_${{ matrix.postgres }}
4661
push: true
4762
set: |
48-
*.platform=linux/amd64,linux/arm64
63+
*.platform=linux/${{ steps.compute_platform.outputs.platform }}
4964
*.cache-to=type=gha,mode=max
5065
*.cache-from=type=gha
51-
postgres.tags=pgduckdb/pgduckdb:${{ matrix.postgres }}-${{ github.sha }}
52-
${{ !contains(github.ref_name, '/') && format('postgres.tags=pgduckdb/pgduckdb:{0}-{1}', matrix.postgres, github.ref_name) || '' }}
66+
postgres.tags=pgduckdb/pgduckdb:${{ matrix.postgres }}-${{ steps.compute_platform.outputs.platform }}-${{ github.sha }}
67+
${{ !contains(github.ref_name, '/') && format('postgres.tags=pgduckdb/pgduckdb:{0}-${1}-{2}', matrix.postgres, steps.compute_platform.outputs.platform, github.ref_name) || '' }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ USER postgres
2727
# Selectively copy the files that we need. Sadly we need separate COPY commands
2828
# for each directory, because docker puts only the contents of the source
2929
# directory into the target directory, and not the directory itself too.
30-
COPY --chown=postgres:postgres Makefile Makefile.global pg_duckdb.control .
30+
COPY --chown=postgres:postgres Makefile Makefile.global pg_duckdb.control ./
3131
COPY --chown=postgres:postgres .git/modules/third_party/duckdb/HEAD .git/modules/third_party/duckdb/HEAD
3232
COPY --chown=postgres:postgres sql sql
3333
COPY --chown=postgres:postgres src src

0 commit comments

Comments
 (0)