Skip to content

Commit beb169d

Browse files
committed
add aarch64 image
- add CI to build, tag and push x86_64 and aarch64 images - add ARCH arg to Dockerfile - build ccache from source as no pre-built aarch64 binary available
1 parent 901ae96 commit beb169d

File tree

3 files changed

+54
-32
lines changed

3 files changed

+54
-32
lines changed

.github/workflows/ci.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CI
2+
on: push
3+
4+
jobs:
5+
manylinux:
6+
runs-on: ${{ matrix.platform.os }}
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
platform:
11+
- os: "ubuntu-22.04"
12+
arch: "x86_64"
13+
- os: "ubuntu-22.04-arm"
14+
arch: "aarch64"
15+
steps:
16+
- uses: actions/checkout@v4
17+
- run: docker compose build . --build-arg="ARCH=${{ matrix.platform.arch }}"
18+
- if: github.repository == 'spatial-model-editor/sme_manylinux' && github.event_name == 'push' && (startsWith(github.event.ref, 'refs/tags/'))
19+
uses: docker/login-action@v3
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
- if: github.repository == 'spatial-model-editor/sme_manylinux' && github.event_name == 'push' && (startsWith(github.event.ref, 'refs/tags/'))
25+
run: |
26+
docker compose build . --build-arg="ARCH=${{ matrix.platform.arch }}" -t ghcr.io/spatial-model-editor/manylinux_${{ matrix.platform.arch }}:${{ github.ref_name }}
27+
docker compose push ghcr.io/spatial-model-editor/manylinux_${{ matrix.platform.arch }}:${{ github.ref_name }}

Dockerfile

+20-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
FROM quay.io/pypa/manylinux_2_28_x86_64:2025-01-05-75aeda9 as builder
1+
ARG ARCH
2+
FROM quay.io/pypa/manylinux_2_28_${ARCH}:2025.02.02-1 as builder
23

4+
ARG ARCH
35
ARG NPROCS=24
46
ARG BUILD_DIR=/opt/smelibs
57
ARG TMP_DIR=/opt/tmpwd
@@ -56,7 +58,7 @@ RUN mkdir -p $TMP_DIR && cd $TMP_DIR \
5658
&& ./configure \
5759
--prefix=$BUILD_DIR \
5860
--disable-shared \
59-
--host=x86_64-unknown-linux-gnu \
61+
--host=${ARCH}-unknown-linux-gnu \
6062
--enable-static \
6163
--with-pic \
6264
--enable-cxx \
@@ -75,7 +77,7 @@ RUN mkdir -p $TMP_DIR && cd $TMP_DIR \
7577
&& ./configure \
7678
--prefix=$BUILD_DIR \
7779
--disable-shared \
78-
--host=x86_64-unknown-linux-gnu \
80+
--host=${ARCH}-unknown-linux-gnu \
7981
--enable-static \
8082
--with-pic \
8183
--with-gmp-lib=$BUILD_DIR/lib \
@@ -182,7 +184,7 @@ RUN mkdir -p $TMP_DIR && cd $TMP_DIR \
182184
&& ninja install \
183185
&& rm -rf $TMP_DIR
184186

185-
ARG LLVM_VERSION="19.1.6"
187+
ARG LLVM_VERSION="19.1.7"
186188
RUN mkdir -p $TMP_DIR && cd $TMP_DIR \
187189
&& git clone \
188190
-b llvmorg-$LLVM_VERSION \
@@ -196,7 +198,7 @@ RUN mkdir -p $TMP_DIR && cd $TMP_DIR \
196198
-DCMAKE_BUILD_TYPE=Release \
197199
-DCMAKE_INSTALL_PREFIX=$BUILD_DIR \
198200
-DPython3_EXECUTABLE:FILEPATH=/opt/python/cp312-cp312/bin/python \
199-
-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-linux-gnu \
201+
-DLLVM_DEFAULT_TARGET_TRIPLE=${ARCH}-unknown-linux-gnu \
200202
-DLLVM_TARGETS_TO_BUILD="X86" \
201203
-DLLVM_BUILD_TOOLS=OFF \
202204
-DLLVM_INCLUDE_TOOLS=OFF \
@@ -724,27 +726,31 @@ RUN mkdir -p $TMP_DIR && cd $TMP_DIR \
724726
&& ninja install \
725727
&& rm -rf $TMP_DIR
726728

727-
FROM quay.io/pypa/manylinux_2_28_x86_64:2025-01-05-75aeda9
729+
FROM quay.io/pypa/manylinux_2_28_${ARCH}:2025.02.02-1
728730

729-
LABEL org.opencontainers.image.source=https://github.com/spatial-model-editor/sme_manylinux_x86_64
730-
LABEL org.opencontainers.image.description="manylinux x86_64 image for compiling Spatial Model Editor python wheels"
731+
LABEL org.opencontainers.image.source=https://github.com/spatial-model-editor/sme_manylinux
732+
LABEL org.opencontainers.image.description="manylinux ${ARCH} image for compiling Spatial Model Editor python wheels"
731733
LABEL org.opencontainers.image.licenses=MIT
732734

733735
ARG BUILD_DIR=/opt/smelibs
734736
ARG TMP_DIR=/opt/tmpwd
735737

738+
RUN /opt/python/cp312-cp312/bin/pip install ninja \
739+
&& ln -fs /opt/python/cp312-cp312/bin/ninja /usr/bin/ninja
740+
736741
ARG CCACHE_VERSION="4.10.2"
737742
RUN mkdir -p $TMP_DIR && cd $TMP_DIR \
738743
&& curl \
739-
-L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz \
744+
-L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}.tar.xz \
740745
--output ccache.tar.xz \
741746
&& tar xJf ccache.tar.xz \
742-
&& cd ccache-${CCACHE_VERSION}-linux-x86_64 \
743-
&& make install \
747+
&& cd ccache-${CCACHE_VERSION} \
748+
&& mkdir build \
749+
&& cd build \
750+
&& cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_DOCUMENTATION=OFF -DHTTP_STORAGE_BACKEND=OFF -DENABLE_TESTING=OFF -DREDIS_STORAGE_BACKEND=OFF -GNinja .. \
751+
&& ninja \
752+
&& ninja install \
744753
&& rm -rf $TMP_DIR
745754

746-
RUN /opt/python/cp312-cp312/bin/pip install ninja \
747-
&& ln -fs /opt/python/cp312-cp312/bin/ninja /usr/bin/ninja
748-
749755
# SME static libs
750756
COPY --from=builder $BUILD_DIR $BUILD_DIR

README.md

+7-18
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,15 @@
1-
# sme_manylinux_x86_64
1+
# sme_manylinux
22

3-
Docker container for compiling linux x86_64 python wheels for [sme](https://pypi.org/project/sme/)
3+
Docker containers for compiling linux python wheels for [sme](https://pypi.org/project/sme/)
44

5-
- Available from <https://ghcr.io/spatial-model-editor/manylinux_x86_64>
5+
- Available from <https://ghcr.io/spatial-model-editor/sme_manylinux>
66

77
- Used by <https://github.com/spatial-model-editor/spatial-model-editor>
88

9-
- Based on <https://quay.io/repository/pypa/manylinux_2_28_x86_64>
9+
- Based on
10+
- <https://quay.io/repository/pypa/manylinux_2_28_x86_64>
11+
- <https://quay.io/repository/pypa/manylinux_2_28_aarch64>
1012

1113
## To update
1214

13-
Update the Dockerfile, tag the commit with `tagname`, git push, then build and push the docker container:
14-
15-
```bash
16-
docker build . -t ghcr.io/spatial-model-editor/manylinux_x86_64:tagname
17-
docker push ghcr.io/spatial-model-editor/manylinux_x86_64:tagname
18-
```
19-
20-
where `tagname` is today's date in the form `YYYY.MM.DD`
21-
22-
## Note
23-
24-
Would be cleaner to have a github action that builds the container on each tagged commit, as we do for sme_deps etc.
25-
26-
Currently not doing this for convenience, as the docker build would take a long time to run on CI.
15+
To release new images, tag the commit with `YYYY.MM.DD`

0 commit comments

Comments
 (0)