Skip to content

Update push-to-docker-hub.yml #254

Update push-to-docker-hub.yml

Update push-to-docker-hub.yml #254

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: 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: false
tags: ${{ github.repository }}:latest
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=${{ github.repository }}:latest
cache-to: type=inline
- uses: kitabisa/docker-slim-action@v1
env:
DSLIM_HTTP_PROBE: false
DSLIM_PULL: false
DSLIM_IMAGE_BUILD_ARCH: linux/amd64
DSLIM_HOST_EXEC: "/bin/bash ls && php-fpm"
with:
target: ${{ github.repository }}:latest
tag: "slim"
- run: docker image push "${{ github.repository }}" --all-tags
- uses: gautamkrishnar/keepalive-workflow@v1 # using the workflow with default settings