Correct targetplatform value #196
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: Continuous Integration | |
on: | |
push: | |
schedule: | |
- cron: '0 17 * * *' # 3 AM AEST | |
jobs: | |
image: | |
env: | |
IMAGE_REPO: ${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPO }} | |
IMAGE_TAG: sha-${{ github.sha }}-${{ matrix.arch }} | |
runs-on: | |
- linux | |
- self-hosted | |
- ${{ matrix.arch }} | |
steps: | |
- uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- uses: docker/build-push-action@v2 | |
with: | |
file: Dockerfile | |
no-cache: ${{ github.event_name == 'schedule' }} | |
push: true | |
tags: ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} | |
- name: Push branch tag | |
run: | | |
docker tag ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} ${{ env.IMAGE_REPO }}:${GITHUB_REF#refs/heads/} | |
docker push ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} | |
docker push ${{ env.IMAGE_REPO }}:${GITHUB_REF#refs/heads/} | |
- name: Push 'latest' tag | |
if: github.ref == 'refs/heads/master' | |
run: | | |
docker tag ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} ${{ env.IMAGE_REPO }}:latest | |
docker push ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} | |
docker push ${{ env.IMAGE_REPO }}:latest | |
- name: Cleanup | |
if: always() | |
run: | | |
export COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME//\//-} | |
docker-compose down --volumes | |
docker rmi -f \ | |
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} \ | |
${{ env.IMAGE_REPO }}:${GITHUB_REF#refs/heads/} | |
if [[ "$BRANCH" == master ]]; then | |
docker rmi -f ${{ env.IMAGE_REPO }}:latest | |
fi | |
strategy: | |
matrix: | |
arch: | |
- arm64 | |
- x64 | |
manifest: | |
env: | |
IMAGE_REPO: ${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPO }} | |
IMAGE_TAG: sha-${{ github.sha }} | |
needs: image | |
runs-on: | |
- linux | |
- self-hosted | |
steps: | |
- uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push branch manifest list | |
run: | | |
docker buildx imagetools create -t \ | |
${{ env.IMAGE_REPO }}:${GITHUB_REF#refs/heads/} \ | |
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}-arm64 \ | |
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}-x64 | |
- name: Push SHA manifest list | |
run: | | |
docker buildx imagetools create -t \ | |
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} \ | |
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}-arm64 \ | |
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}-x64 | |
- name: Push 'latest' manifest list | |
if: github.ref == 'refs/heads/master' | |
run: | | |
# Latest. | |
docker buildx imagetools create -t \ | |
${{ env.IMAGE_REPO }}:latest \ | |
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}-arm64 \ | |
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}-x64 | |
- name: Remove arch tags | |
run: | | |
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "${{ secrets.DOCKER_USERNAME }}", "password": "${{ secrets.DOCKER_PASSWORD }}"}' "https://hub.docker.com/v2/users/login/" | jq -r '.token') | |
curl "https://hub.docker.com/v2/repositories/${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPO }}/tags/${{ env.IMAGE_TAG }}-arm64/" -X DELETE -H "Authorization: JWT ${TOKEN}" | |
curl "https://hub.docker.com/v2/repositories/${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPO }}/tags/${{ env.IMAGE_TAG }}-x64/" -X DELETE -H "Authorization: JWT ${TOKEN}" | |
readme: | |
needs: image | |
runs-on: | |
- self-hosted | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: peter-evans/dockerhub-description@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
repository: ${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPO }} |