feat: add slim image (#14) #141
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
DOCKER_REPOSITORY: quay.io/unstructured-io | |
DOCKER_BUILD_REPOSITORY: quay.io/unstructured-io/build-base-images | |
DOCKER_IMAGE: base-images | |
jobs: | |
set-short-sha: | |
runs-on: ubuntu-latest | |
outputs: | |
short_sha: ${{ steps.set_short_sha.outputs.short_sha }} | |
steps: | |
- name: Set Short SHA | |
id: set_short_sha | |
run: echo "short_sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT | |
build-images: | |
strategy: | |
matrix: | |
docker-platform: ["linux/arm64", "linux/amd64"] | |
images: ["rocky9.2-9", "rocky9.2-9-slim"] | |
runs-on: ubuntu-latest-m | |
needs: [set-short-sha] | |
env: | |
SHORT_SHA: ${{ needs.set-short-sha.outputs.short_sha }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to Quay.io | |
uses: docker/login-action@v2 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_IO_ROBOT_USERNAME }} | |
password: ${{ secrets.QUAY_IO_ROBOT_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Build base images | |
run: | | |
make build-base-images | |
env: | |
DOCKER_PLATFORM: ${{ matrix.docker-platform }} | |
DOCKERFILE: ${{ matrix.images }} | |
CI: "true" | |
publish-images: | |
strategy: | |
matrix: | |
images: ["rocky9.2-9", rocky9.2-9-slim"] | |
env: | |
SHORT_SHA: ${{ needs.set-short-sha.outputs.short_sha }} | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
needs: [set-short-sha, build-images] | |
steps: | |
- uses: docker/setup-buildx-action@v1 | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Login to Quay.io | |
uses: docker/login-action@v2 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_IO_ROBOT_USERNAME }} | |
password: ${{ secrets.QUAY_IO_ROBOT_TOKEN }} | |
- name: Pull AMD image | |
run: | | |
docker pull --platform linux/amd64 $DOCKER_BUILD_REPOSITORY:${{ matrix.images }}-amd64-$SHORT_SHA | |
docker tag $DOCKER_BUILD_REPOSITORY:${{ matrix.images }}-amd64-$SHORT_SHA $DOCKER_BUILD_REPOSITORY:${{ matrix.images }}-amd64 | |
docker push $DOCKER_BUILD_REPOSITORY:${{ matrix.images }}-amd64 | |
- name: Pull ARM image | |
run: | | |
docker pull --platform linux/arm64 $DOCKER_BUILD_REPOSITORY:${{ matrix.images }}-arm64-$SHORT_SHA | |
docker tag $DOCKER_BUILD_REPOSITORY:${{ matrix.images }}-arm64-$SHORT_SHA $DOCKER_BUILD_REPOSITORY:${{ matrix.images }}-arm64 | |
docker push $DOCKER_BUILD_REPOSITORY:${{ matrix.images }}-arm64 | |
- name: Push multiarch manifest | |
run: | | |
docker manifest create $DOCKER_REPOSITORY/$DOCKER_IMAGE:${{ matrix.images }} $DOCKER_BUILD_REPOSITORY:${{ matrix.images }}-amd64 $DOCKER_BUILD_REPOSITORY:${{ matrix.images }}-arm64 | |
docker manifest push $DOCKER_REPOSITORY/$DOCKER_IMAGE:${{ matrix.images }} | |
shellcheck: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: ShellCheck | |
uses: ludeeus/action-shellcheck@master |