Skip to content

Commit

Permalink
[FEATURE] Add arm64-platform support (e.g. for Apple Silicon processo…
Browse files Browse the repository at this point in the history
…rs) to docker-image

This PR also updates all required actions in .github/workflow/ci.yml and adds a new
publish-docker-hub job to the pipeline.

Fixes: TYPO3-Solr#2891
  • Loading branch information
sjorek committed Feb 19, 2023
1 parent 898ae56 commit 295bc9e
Showing 1 changed file with 128 additions and 17 deletions.
145 changes: 128 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ jobs:
outputs:
matrix: ${{ steps.collect_build_matrix.outputs.matrix }}
steps:
# Workaround for issue with actions/checkout@v2 wrong PR commit checkout: See https://github.com/actions/checkout/issues/299#issuecomment-677674415
# Workaround for issue with actions/checkout@v2+ wrong PR commit checkout: See https://github.com/actions/checkout/issues/299#issuecomment-677674415
-
name: Checkout current state of Pull Request
if: github.event_name == 'pull_request'
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
-
name: Checkout current state of Branch
if: github.event_name == 'push'
uses: actions/checkout@v2
# End: Workaround for issue with actions/checkout@v2 wrong PR commit checkout
uses: actions/checkout@v3
# End: Workaround for issue with actions/checkout@v2+ wrong PR commit checkout
-
name: "Resolve target branch of pull request."
if: github.event_name == 'pull_request'
Expand Down Expand Up @@ -71,10 +71,10 @@ jobs:
>&2 echo -e "Non-stable releases can not be published to TER. The tag 11.5.0-beta-1 is invalid for TER."
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
-
name: Build Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
file: ./Docker/SolrServer/Dockerfile
Expand All @@ -90,7 +90,7 @@ jobs:
./Build/Test/cibuild_docker.sh
-
name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: solrci-image
path: /tmp/solrci-image.tar
Expand All @@ -111,21 +111,21 @@ jobs:

name: TYPO3 ${{ matrix.TYPO3 }} on PHP ${{ matrix.PHP }}
steps:
# Workaround for issue with actions/checkout@v2 wrong PR commit checkout: See https://github.com/actions/checkout/issues/299#issuecomment-677674415
# Workaround for issue with actions/checkout@v2+ wrong PR commit checkout: See https://github.com/actions/checkout/issues/299#issuecomment-677674415
-
name: Checkout current state of Pull Request
if: github.event_name == 'pull_request'
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2
ref: ${{ github.event.pull_request.head.sha }}
-
name: Checkout current state of Branch
if: github.event_name == 'push'
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2
# End: Workaround for issue with actions/checkout@v2 wrong PR commit checkout
# End: Workaround for issue with actions/checkout@v2+ wrong PR commit checkout
-
name: Mount RAMFS
run: |
Expand All @@ -136,10 +136,10 @@ jobs:
&& sudo chown 8983:8983 ${{ env.CI_BUILD_DIRECTORY }}/data-solr
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
-
name: Download solrci-image from "ci_bootstrapping" job
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: solrci-image
path: /tmp
Expand Down Expand Up @@ -175,11 +175,11 @@ jobs:
export CI_BUILD_CACHE_KEY=${{ runner.os }}-PHP:${{ matrix.PHP }}-TYPO3:$TYPO3_VERSION@$CURRENT_TYPO3_VERSION_REFERNCE-SOLARIUM:$CURRENT_SOLARIUM_VERSION-"CI_CACHE_VERSION:"$CI_CACHE_VERSION
echo "COMPOSER_GLOBAL_REQUEREMENTS=$(composer config home)" >> $GITHUB_ENV
echo "CI_BUILD_CACHE_KEY=$CI_BUILD_CACHE_KEY" >> $GITHUB_ENV
echo "The key for actions/cache@v2 is \"$CI_BUILD_CACHE_KEY\""
echo "The key for actions/cache@v3 is \"$CI_BUILD_CACHE_KEY\""
-
name: Restore ci build caches
id: restore_ci_build_caches
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
${{ env.CI_BUILD_DIRECTORY }}/Web
Expand Down Expand Up @@ -217,7 +217,7 @@ jobs:
${{ env.CI_BUILD_DIRECTORY }}/data-mysql \
${{ env.CI_BUILD_DIRECTORY }}/data-solr
publish:
publish-typo3-ter:
name: Publish new version to TER
needs: tests
if: startsWith(github.ref, 'refs/tags/')
Expand All @@ -227,7 +227,7 @@ jobs:
steps:
-
name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
-
Expand Down Expand Up @@ -269,3 +269,114 @@ jobs:
exit 13
fi
php ~/.composer/vendor/bin/tailor ter:publish --comment "$TER_COMMENT" "$RELEASE_VERSION"
publish-docker-hub:
name: Publish TYPO3 ext-solr docker-image to docker-hub
needs: tests
if: |
(
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release-') ||
startsWith(github.ref, 'refs/tags/')
)
runs-on: ubuntu-latest
env:
DOCKER_PLATFORMS: "linux/amd64,linux/arm64"
DOCKER_IMAGE_NAME: "${{ secrets.DOCKERHUB_USERNAME }}/ext-solr"
# is overriden below
DOCKER_IMAGE_TAGS: ""
steps:
-
name: Checkout
uses: actions/checkout@v3
#
# git-branch : main
# image-tag : typo3solr/ext-solr:latest
#
# git-branch : release-11.5.x
# image-tag : release-11.5.x typo3solr/ext-solr:release-11.5.x
#
-
name: Export docker-image tag(s) for main and release-* git-branches
if: startsWith(github.ref, 'refs/heads/')
run: |
TAGS="${DOCKER_IMAGE_NAME}:${GITHUB_REF_NAME//main/latest}"
echo "DOCKER_IMAGE_TAGS=${TAGS}" | tee -a $GITHUB_ENV
#
# git-tag : 11.5.1
# image-tags : typo3solr/ext-solr:11.5.1,typo3solr/ext-solr:11.5,typo3solr/ext-solr:11
#
# git-tag : 11.2.1
# image-tags : typo3solr/ext-solr:11.2.1,typo3solr/ext-solr:11.2
#
# git-tag : 10.0.5
# image-tags : typo3solr/ext-solr:10.0.5,typo3solr/ext-solr:10.0,typo3solr/ext-solr:10
#
-
name: Export docker-image tag(s) for release git-tags
if: ( startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-') )
run: |
# image-tag: typo3solr/ext-solr:11.5.1
TAGS="${DOCKER_IMAGE_NAME}:${GITHUB_REF_NAME}"
# image-tag: typo3solr/ext-solr:11.5
TAGS="${DOCKER_IMAGE_NAME}:${GITHUB_REF_NAME%.*}${TAGS+,$TAGS}"
VERSION_MAJOR_ONLY="${GITHUB_REF_NAME%%.*}"
VERSION_MAJOR_MINOR="${GITHUB_REF_NAME%.*}"
VERSION_LASTEST=$(git tag -l --sort -version:refname | grep -E "^${VERSION_MAJOR_ONLY}\\." | head -n1)
if [ "${VERSION_LASTEST%.*}" = "${VERSION_MAJOR_MINOR}" ]; then
# image-tag: typo3solr/ext-solr:11
TAGS="${DOCKER_IMAGE_NAME}:${VERSION_MAJOR_ONLY}${TAGS+,$TAGS}"
fi
echo "DOCKER_IMAGE_TAGS=${TAGS}" | tee -a $GITHUB_ENV
#
# git-tag : 11.5.0-rc-3
# image-tag : typo3solr/ext-solr:11.5.x-dev
#
-
name: Export docker-image tag(s) for pre-release git-tags
if: ( startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-') )
run: |
# ie: typo3solr/ext-solr:11.5.x-dev
TAGS="${DOCKER_IMAGE_NAME}:${GITHUB_REF_NAME%.*}.x-dev"
echo "DOCKER_IMAGE_TAGS=${TAGS}" | tee -a $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Download solrci-image from "ci_bootstrapping" job
uses: actions/download-artifact@v3
with:
name: solrci-image
path: /tmp
-
name: Load image
run: |
docker load --input /tmp/solrci-image.tar
docker image ls -a
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Docker/SolrServer/Dockerfile
platforms: ${{ env.DOCKER_IMAGE_TAGS }}
push: true
tags: ${{ env.DOCKER_IMAGE_TAGS }}
-
name: Inspect all images
run: |
docker image inspect ${DOCKER_IMAGE_TAGS//,/ }

0 comments on commit 295bc9e

Please sign in to comment.