Publish Docker #390
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: Publish Docker # | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 2 * * 0' # Weekly on Sundays at 02:00 | |
permissions: | |
contents: write | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
outputs: | |
image-needs-updating: ${{ steps.check.outputs.needs-updating }} | |
steps: | |
- name: Docker Image Update Checker | |
id: check | |
uses: lucacome/docker-image-update-checker@v1.2.1 | |
with: | |
base-image: library/nextcloud:latest | |
image: ${{ github.repository }}:latest | |
if: ${{ github.event_name == 'schedule' }} | |
build: | |
needs: check | |
if: ${{ github.event_name != 'schedule' || needs.check.outputs.image-needs-updating == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# - name: Cache Docker layers | |
# uses: actions/cache@v4 | |
# with: | |
# path: /tmp/.buildx-cache | |
# key: ${{ runner.os }}-buildx-${{ github.sha }} | |
# restore-keys: | | |
# ${{ runner.os }}-buildx- | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ github.repository }}:latest | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=registry,ref=gymnae/owncloud:buildcache | |
cache-to: type=registry,ref=gymnae/owncloud:buildcache | |
# -# Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
#name: Move cache | |
#run: | | |
# rm -rf tmp/.buildx-cache | |
# mv tmp/.buildx-cache-new /tmp/.buildx-cach | |
# - uses: kitabisa/docker-slim-action@v1 | |
# env: | |
# DSLIM_HTTP_PROBE: false | |
# DSLIM_PULL: true | |
# DSLIM_IMAGE_BUILD_ARCH: amd64 | |
# DSLIM_HOST_EXEC: "/bin/bash ls && php-fpm" | |
# with: | |
# target: ${{ github.repository }}:latest | |
# tag: "slim" | |
# - run: docker image push "${{ github.repository }}" --all-tags | |
keepalive-job: | |
name: Keepalive Workflow | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gautamkrishnar/keepalive-workflow@v2 |