1
Fork 0

Ghactions save docker images in artifacts

This commit is contained in:
Viktor Strate Kløvedal 2021-03-28 21:24:32 +02:00 committed by GitHub
parent f2bb1335e6
commit 5ec05e54ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 14 deletions

View File

@ -12,7 +12,7 @@ on:
jobs: jobs:
build: build:
name: Build and deploy docker images name: Build Docker Image
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
@ -78,21 +78,41 @@ jobs:
--build-arg VCS_REF=${GITHUB_SHA::8} \ --build-arg VCS_REF=${GITHUB_SHA::8} \
${TAGS} --file Dockerfile . ${TAGS} --file Dockerfile .
- name: Build Docker images - name: Docker Build
run: | run: |
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }} docker buildx build --output "type=oci,dest=/tmp/docker-image-${{ matrix.target_platform }}-${{ github.sha }}.oci" ${{ steps.prepare.outputs.buildx_args }}
- name: Save Image
uses: actions/upload-artifact@v2
with:
name: docker-image-${{ matrix.target_platform }}
path: /tmp/docker-image-${{ matrix.target_platform }}-${{ github.sha }}.oci
- name: Docker Login push:
if: success() && github.event_name != 'pull_request' && github.repository == 'photoview/photoview' name: Push Docker Images
env: runs-on: ubuntu-20.04
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} if: github.event_name != 'pull_request' && github.repository == 'photoview/photoview'
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${{ steps.prepare.outputs.docker_username }}" --password-stdin needs: [build]
- name: Push to Docker Hub steps:
if: success() && github.event_name != 'pull_request' && github.repository == 'photoview/photoview' - name: Load Images
run: | uses: actions/download-artifact@v2
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} with:
path: /docker-images
- name: Print Artifacts
run: ls -lah /docker-images
#- 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 # - name: Docker Check Manifest
# if: always() && github.event_name != 'pull_request' && github.repository == 'photoview/photoview' # if: always() && github.event_name != 'pull_request' && github.repository == 'photoview/photoview'
@ -100,6 +120,5 @@ jobs:
# docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} # docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
- name: Clear - name: Clear
if: always() && github.event_name != 'pull_request'
run: | run: |
rm -f ${HOME}/.docker/config.json rm -f ${HOME}/.docker/config.json