Skip to content

Commit

Permalink
Implement docker arm build (necessary for Pull Request #34) (#37)
Browse files Browse the repository at this point in the history
Enable CI docker builds; switch to manylinux 2_28; enable ARM Docker build
  • Loading branch information
jonded94 authored Mar 7, 2024
1 parent 68d3050 commit 22f7816
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 3 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build manylinux docker container

on:
push:
tags:
- '*'
branches:
- develop
- ci/*
paths:
- Dockerfile

pull_request:
types:
- opened
- synchronize
branches:
- develop
paths:
- Dockerfile

env:
REGISTRY: ghcr.io

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Prepare
run: |
if [ "${{ matrix.platform }}" = "linux/amd64" ]; then
echo "TARGET_ARCH=x86_64" >> $GITHUB_ENV
elif [ "${{ matrix.platform }}" = "linux/arm64" ]; then
echo "TARGET_ARCH=aarch64" >> $GITHUB_ENV
fi
- name: Checkout
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build
id: docker_build
uses: docker/build-push-action@v5
with:
context: ./
file: ./Dockerfile
push: ${{ github.ref == 'refs/heads/develop' }}
platforms: ${{ matrix.platform }}
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/resiliparse-manylinux_2_28_${{ env.TARGET_ARCH }}:latest
build-args: |
TARGET_ARCH=${{ env.TARGET_ARCH }}
19 changes: 16 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
FROM quay.io/pypa/manylinux2014_x86_64:latest
ARG TARGET_ARCH
FROM quay.io/pypa/manylinux_2_28_${TARGET_ARCH}:latest

RUN set -x \
&& yum install -y \
devtoolset-10-libasan-devel \
gcc-toolset-10-libasan-devel \
lz4-devel \
uchardet-devel \
zlib-devel

RUN set -x \
&& curl -Lf https://gitlab.freedesktop.org/uchardet/uchardet/-/archive/v0.0.8/uchardet-v0.0.8.tar.gz > uchardet.tar.gz \
&& tar -xf uchardet.tar.gz \
&& (cd uchardet-* && mkdir build \
&& cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_CXX_STANDARD=17 \
-DLEXBOR_BUILD_STATIC=ON \
-B build \
&& cmake --build build -j$(nproc) --target install) \
&& rm -rf uchardet*

RUN set -x \
&& curl -Lf https://github.com/lexbor/lexbor/archive/refs/tags/v2.2.0.tar.gz > lexbor.tar.gz \
&& tar -xf lexbor.tar.gz \
Expand Down

0 comments on commit 22f7816

Please sign in to comment.