Skip to content

feat: Build images for linux/arm/v7 and linux/arm64 (#9, @schmidp) #122

feat: Build images for linux/arm/v7 and linux/arm64 (#9, @schmidp)

feat: Build images for linux/arm/v7 and linux/arm64 (#9, @schmidp) #122

Workflow file for this run

name: Update Docker Images
on:
push:
branches:
- master
schedule:
# At 12:00 on Tuesday.
- cron: '0 12 * * 2'
jobs:
rebase_images:
name: Update Images
runs-on: ubuntu-latest
strategy:
matrix:
spa_server_major_version: [ "latest", "1" ]
# "{0}" will be replaced by the latest pushed nginx version
nginx: [ "mainline", "stable", "{0}" ]
steps:
- uses: actions/checkout@v2
- name: Get latest nginx tag
id: latest_nginx_tag
uses: ./.github/actions/latest-docker-repository-version
with:
repository: "nginxinc/nginx-unprivileged"
- name: Set target nginx tag
id: target_nginx_tag
run: |
NGINX_VERSION="${{ format(matrix.nginx, steps.latest_nginx_tag.outputs.version) }}-alpine"
echo "::set-output name=tag::${NGINX_VERSION}"
echo "NGINX_VERSION=${NGINX_VERSION}"
- name: Set target image name
id: target_image_name
run: |
IMAGE_TAG="${{ matrix.spa_server_major_version }}-nginx-${{ steps.target_nginx_tag.outputs.tag }}"
IMAGE_NAME="${{ secrets.DOCKER_REPOSITORY }}:${IMAGE_TAG}"
echo "::set-output name=image_name::${IMAGE_NAME}"
echo "IMAGE_NAME=${IMAGE_NAME}"
TAGS="${{ secrets.DOCKER_REPOSITORY }}:${IMAGE_TAG}"
if [ "latest" = "${{ matrix.spa_server_major_version }}" ] && [ "stable" = "${{ matrix.nginx }}" ]; then
TAGS="${TAGS},${{ secrets.DOCKER_REPOSITORY }}:latest"
fi
echo "::set-output name=tags::${TAGS}"
echo "TAGS=${TAGS}"
- name: Check if update is necessary
id: check_if_update_is_necessary
uses: ./.github/actions/check-docker-image-needs-update
with:
base-image: "nginxinc/nginx-unprivileged:${{ steps.target_nginx_tag.outputs.tag }}"
target-image: "${{ steps.target_image_name.outputs.image_name }}"
- name: Find latest SPA-Server release for major version ${{ matrix.spa_server_major_version }}
id: latest_release
uses: PSanetra/git-semver-actions/latest@v1
with:
major-version: ${{ matrix.spa_server_major_version }}
if: steps.check_if_update_is_necessary.outputs.needs_update == 'true'
- name: Fix https://github.com/actions/checkout/issues/164 on tag checkout
run: sudo chmod -R ugo+rwX .
if: steps.check_if_update_is_necessary.outputs.needs_update == 'true'
- name: Checkout latest SPA-Server version for major version ${{ matrix.spa_server_major_version }}
uses: actions/checkout@v2
with:
ref: "v${{ steps.latest_release.outputs.version }}"
if: steps.check_if_update_is_necessary.outputs.needs_update == 'true'
- run: "./.github/workflows/install-dependencies.sh"
if: steps.check_if_update_is_necessary.outputs.needs_update == 'true'
- uses: actions/setup-java@v1
with:
java-version: '11'
if: steps.check_if_update_is_necessary.outputs.needs_update == 'true'
- run: "make test NGINX_TAG=\"${{ steps.target_nginx_tag.outputs.tag }}\""
if: steps.check_if_update_is_necessary.outputs.needs_update == 'true'
- uses: docker/setup-qemu-action@v2
name: Set up QEMU
- uses: docker/setup-buildx-action@v2
name: Set up Docker Buildx
- uses: docker/login-action@v2
name: Login to Docker Hub
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/build-push-action@v4
name: Build and push
if: ${{ steps.check_if_update_is_necessary.outputs.needs_update == 'true' && steps.target_image_name.outputs.tags != '' }}
with:
context: .
platforms: linux/arm/v7,linux/amd64,linux/arm64
push: true
pull: true
tags: ${{ steps.target_image_name.outputs.tags }}
build-args: NGINX_TAG=${{ steps.target_nginx_tag.outputs.tag }}