Skip to content

Commit

Permalink
feat: create base image for manylinux2014
Browse files Browse the repository at this point in the history
With CentOS 7 having reach EOL, packages versions are now immutable.
Creating a base image with manylinux runtime packages allows to reduce image size and improve cache efficiency.
  • Loading branch information
mayeut committed Nov 3, 2024
1 parent e162370 commit 2785dcd
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 348 deletions.
84 changes: 26 additions & 58 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,74 +28,42 @@ concurrency:
cancel-in-progress: true

jobs:
build_manylinux:
name: ${{ matrix.policy }}_${{ matrix.platform }}
build_manylinux2014_base:
runs-on: ubuntu-22.04
permissions:
actions: write # this permission is needed to delete cache
strategy:
fail-fast: false
matrix:
policy: ["manylinux2014", "musllinux_1_2"]
platform: ["i686", "x86_64"]
include:
- policy: "manylinux_2_28"
platform: "x86_64"

env:
POLICY: ${{ matrix.policy }}
PLATFORM: ${{ matrix.platform }}
COMMIT_SHA: ${{ github.sha }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 50

- name: Set up emulation
if: matrix.platform != 'i686' && matrix.platform != 'x86_64'
- name: Get tag name
id: tag
run: |
COMMIT_DATE=$(git show -s --format=%cd --date=short ${{ github.sha }})
if $(git rev-parse --is-shallow-repository); then
git fetch --unshallow
fi
BUILD_NUMBER=$(git rev-list --since=${COMMIT_DATE}T00:00:00Z --first-parent --count ${{ github.sha }})
BUILD_ID2=${COMMIT_DATE//-/.}-${BUILD_NUMBER}
echo "tag=${BUILD_ID2}" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.platform }}

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

- name: Restore cache
if: github.event_name != 'workflow_dispatch' || fromJSON(github.event.inputs.useCache)
uses: actions/cache/restore@v4
- name: Login to Quay.io
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
path: .buildx-cache-${{ matrix.policy }}_${{ matrix.platform }}/*
key: buildx-cache-${{ matrix.policy }}-${{ matrix.platform }}
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build
run: ./build.sh

- name: Delete cache
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
KEY="buildx-cache-${{ matrix.policy }}-${{ matrix.platform }}"
gh cache delete ${KEY} || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Save cache
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/cache/save@v4
- name: Build image
uses: docker/build-push-action@v6
with:
path: .buildx-cache-${{ matrix.policy }}_${{ matrix.platform }}/*
key: buildx-cache-${{ matrix.policy }}-${{ matrix.platform }}

- name: Deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'pypa/manylinux'
run: ./deploy.sh
env:
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}

all_passed:
needs: [build_manylinux]
runs-on: ubuntu-latest
steps:
- run: echo "All jobs passed"
context: ./docker
platforms: linux/arm64,linux/x86_64,linux/386,linux/ppc64le,linux/s390x
load: false
push: true
tags: quay.io/pypa/manylinux2014_base:latest,quay.io/pypa/manylinux2014_base:${{ steps.tag.outputs.tag }}
58 changes: 0 additions & 58 deletions .github/workflows/update-dependencies.yml

This file was deleted.

93 changes: 0 additions & 93 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 2785dcd

Please sign in to comment.