Skip to content

Merge pull request #48 from erseco/renovate/docker-setup-buildx-actio… #129

Merge pull request #48 from erseco/renovate/docker-setup-buildx-actio…

Merge pull request #48 from erseco/renovate/docker-setup-buildx-actio… #129

Workflow file for this run

name: buildx
on:
push:
pull_request:
jobs:
buildx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare
id: prepare
run: |
DOCKER_IMAGE=erseco/alpine-moodle
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x
VERSION=${GITHUB_REF#refs/*/}
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
if [[ $VERSION == "master" ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:beta"
fi
echo ::set-output name=platforms::${DOCKER_PLATFORMS}
echo ::set-output name=tags::${TAGS}
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
id: buildx
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build
run: |
docker buildx build .
- name: Test
run: |
docker-compose version
docker-compose --file docker-compose.test.yml up --exit-code-from sut --timeout 10 --build
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prepare.outputs.tags }}
platforms: ${{ steps.prepare.outputs.platforms }}
# - name: Docker Hub Description
# uses: peter-evans/dockerhub-description@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKERHUB_PASSWORD }}
# short-description: ${{ github.event.repository.description }}