Files
scrypted/.github/workflows/docker.yml
2021-12-04 13:22:30 -08:00

81 lines
2.4 KiB
YAML

name: Publish Docker image
on:
workflow_dispatch:
release:
types: [published]
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '30 8 * * *'
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to Github Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
# Key is named differently to avoid collision
key: ${{ runner.os }}-multi-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-multi-buildx
- name: Build and push Docker image (scrypted-common)
uses: docker/build-push-action@v2
with:
build-args: GITHUB_SHA=${{ env.GITHUB_SHA }}
context: .
file: docker/Dockerfile.common
platforms: linux/amd64,linux/arm64,linux/armhf
push: true
tags: |
koush/scrypted-common:latest
ghcr.io/koush/scrypted-common:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
- name: Build and push Docker image (scrypted)
uses: docker/build-push-action@v2
with:
build-args: GITHUB_SHA=${{ env.GITHUB_SHA }}
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64,linux/armhf
push: true
tags: |
koush/scrypted:latest
ghcr.io/koush/scrypted:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
# prevent cache from growing forever
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache