mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 20:39:08 +00:00
Fix github actions docker builds (#152)
- Use QEMU for multiplatforms (needed after updating buildx-action) - Cleanup Dockerfile
This commit is contained in:
committed by
GitHub
parent
4980a77efb
commit
f2212988b7
21
.github/workflows/build.yml
vendored
21
.github/workflows/build.yml
vendored
@@ -1,5 +1,8 @@
|
||||
name: Docker builds
|
||||
|
||||
env:
|
||||
TARGET_PLATFORMS: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 10 * * *" # everyday at 10am
|
||||
@@ -27,12 +30,20 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
platforms: ${{ env.TARGET_PLATFORMS }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Prepare
|
||||
id: prepare
|
||||
run: |
|
||||
DOCKER_USERNAME=viktorstrate
|
||||
DOCKER_IMAGE=viktorstrate/photoview
|
||||
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
|
||||
DOCKER_PLATFORMS=${TARGET_PLATFORMS}
|
||||
VERSION=edge
|
||||
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
@@ -53,6 +64,7 @@ jobs:
|
||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||
echo ::set-output name=version::${VERSION}
|
||||
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
|
||||
--progress=plain \
|
||||
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
||||
--build-arg VERSION=${VERSION} \
|
||||
@@ -60,10 +72,7 @@ jobs:
|
||||
--build-arg VCS_REF=${GITHUB_SHA::8} \
|
||||
${TAGS} --file Dockerfile .
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Docker Buildx (build)
|
||||
- name: Build Docker images
|
||||
run: |
|
||||
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
|
||||
|
||||
@@ -74,7 +83,7 @@ jobs:
|
||||
run: |
|
||||
echo "${DOCKER_PASSWORD}" | docker login --username "${{ steps.prepare.outputs.docker_username }}" --password-stdin
|
||||
|
||||
- name: Docker Buildx (push)
|
||||
- name: Push to Docker Hub
|
||||
if: success() && github.event_name != 'pull_request' && github.repository == 'viktorstrate/photoview'
|
||||
run: |
|
||||
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
|
||||
|
||||
Reference in New Issue
Block a user