Push individual images, combine afterwards
This commit is contained in:
parent
1543f74f6c
commit
cf36b9ec8d
|
@ -10,6 +10,11 @@ on:
|
||||||
tags:
|
tags:
|
||||||
- v*
|
- v*
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKER_USERNAME: viktorstrate
|
||||||
|
DOCKER_IMAGE: viktorstrate/photoview
|
||||||
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build Docker Image
|
name: Build Docker Image
|
||||||
|
@ -19,9 +24,9 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
target_platform:
|
target_platform:
|
||||||
- "linux/amd64"
|
- "linux/amd64"
|
||||||
- "linux/arm/v6"
|
|
||||||
- "linux/arm/v7"
|
|
||||||
- "linux/arm64"
|
- "linux/arm64"
|
||||||
|
- "linux/arm/v7"
|
||||||
|
- "linux/arm/v6"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -47,8 +52,6 @@ jobs:
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
id: prepare
|
id: prepare
|
||||||
run: |
|
run: |
|
||||||
DOCKER_USERNAME=viktorstrate
|
|
||||||
DOCKER_IMAGE=viktorstrate/photoview
|
|
||||||
DOCKER_PLATFORMS=${{ matrix.target_platform }}
|
DOCKER_PLATFORMS=${{ matrix.target_platform }}
|
||||||
VERSION=edge
|
VERSION=edge
|
||||||
|
|
||||||
|
@ -59,12 +62,10 @@ jobs:
|
||||||
VERSION=nightly
|
VERSION=nightly
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
|
OUTPUT_PLATFORM=$(echo ${{ matrix.target_platform }} | sed 's/\//-/g')
|
||||||
if [[ $VERSION =~ ^(([0-9]{1,3})\.[0-9]{1,3})\.[0-9]{1,3}$ ]]; then
|
echo ::set-output name=output_platform::${OUTPUT_PLATFORM}
|
||||||
VERSION_MINOR=${BASH_REMATCH[1]}
|
|
||||||
VERSION_MAJOR=${BASH_REMATCH[2]}
|
TAG="--tag ${OUTPUT_PLATFORM}-${GITHUB_SHA::8}"
|
||||||
TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest --tag ${DOCKER_IMAGE}:${VERSION_MINOR} --tag ${DOCKER_IMAGE}:${VERSION_MAJOR}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ::set-output name=docker_username::${DOCKER_USERNAME}
|
echo ::set-output name=docker_username::${DOCKER_USERNAME}
|
||||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||||
|
@ -76,51 +77,44 @@ jobs:
|
||||||
--build-arg VERSION=${VERSION} \
|
--build-arg VERSION=${VERSION} \
|
||||||
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
|
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
|
||||||
--build-arg VCS_REF=${GITHUB_SHA::8} \
|
--build-arg VCS_REF=${GITHUB_SHA::8} \
|
||||||
${TAGS} --file Dockerfile .
|
${TAG} --file Dockerfile .
|
||||||
|
|
||||||
OUTPUT_PLATFORM=$(echo ${{ matrix.target_platform }} | sed 's/\//-/g')
|
|
||||||
echo ::set-output name=output_platform::${OUTPUT_PLATFORM}
|
|
||||||
|
|
||||||
- name: Docker Build
|
- name: Docker Build
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/docker-image-${{ matrix.target_platform }}
|
mkdir -p /tmp/docker-image-${{ matrix.target_platform }}
|
||||||
docker buildx build --output "type=oci,dest=/tmp/docker-image-${{ steps.prepare.outputs.output_platform }}-${{ github.sha }}.oci" ${{ steps.prepare.outputs.buildx_args }}
|
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args
|
||||||
|
|
||||||
- name: Save Image
|
- name: Docker Login
|
||||||
uses: actions/upload-artifact@v2
|
run: |
|
||||||
with:
|
echo "${DOCKER_PASSWORD}" | docker login --username "${{ steps.prepare.outputs.docker_username }}" --password-stdin
|
||||||
name: docker-image-${{ steps.prepare.outputs.output_platform }}
|
|
||||||
path: /tmp/docker-image-${{ steps.prepare.outputs.output_platform }}-${{ github.sha }}.oci
|
|
||||||
|
|
||||||
push:
|
- name: Push to Docker Hub
|
||||||
name: Push Docker Images
|
run: |
|
||||||
|
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
|
||||||
|
|
||||||
|
- name: Clear
|
||||||
|
run: |
|
||||||
|
rm -f ${HOME}/.docker/config.json
|
||||||
|
|
||||||
|
docker-manifest:
|
||||||
|
name: Combine Docker Images
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
if: github.event_name != 'pull_request' && github.repository == 'photoview/photoview'
|
if: github.event_name != 'pull_request' && github.repository == 'photoview/photoview'
|
||||||
|
|
||||||
needs: [build]
|
needs: [build]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Load Images
|
- name: Docker Login
|
||||||
uses: actions/download-artifact@v2
|
|
||||||
|
|
||||||
- name: Print Artifacts
|
|
||||||
run: ls -R
|
|
||||||
|
|
||||||
#- name: Docker Login
|
|
||||||
# env:
|
|
||||||
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
# run: |
|
|
||||||
# echo "${DOCKER_PASSWORD}" | docker login --username "${{ steps.prepare.outputs.docker_username }}" --password-stdin
|
|
||||||
|
|
||||||
#- name: Push to Docker Hub
|
|
||||||
# run: |
|
|
||||||
# docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
|
|
||||||
|
|
||||||
# - name: Docker Check Manifest
|
|
||||||
# if: always() && github.event_name != 'pull_request' && github.repository == 'photoview/photoview'
|
|
||||||
# run: |
|
|
||||||
# docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
|
|
||||||
|
|
||||||
- name: Clear
|
|
||||||
run: |
|
run: |
|
||||||
rm -f ${HOME}/.docker/config.json
|
echo "${DOCKER_PASSWORD}" | docker login --username "${{ steps.prepare.outputs.docker_username }}" --password-stdin
|
||||||
|
|
||||||
|
- name: Create Manifest
|
||||||
|
run: |
|
||||||
|
DOCKER_IMAGES="viktorstrate/photoview:linux-amd64-${GITHUB_SHA::8}"
|
||||||
|
DOCKER_IMAGES="${DOCKER_IMAGES} viktorstrate/photoview:linux-arm64-${GITHUB_SHA::8}"
|
||||||
|
DOCKER_IMAGES="${DOCKER_IMAGES} viktorstrate/photoview:linux-arm-v7-${GITHUB_SHA::8}"
|
||||||
|
DOCKER_IMAGES="${DOCKER_IMAGES} viktorstrate/photoview:linux-arm-v6-${GITHUB_SHA::8}"
|
||||||
|
|
||||||
|
docker manifest create viktorstrate/photoview:test ${DOCKER_IMAGES}
|
||||||
|
docker manifest push viktorstrate/photoview:test
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue