This commit is contained in:
DevMiner 2023-10-22 11:11:12 +02:00
parent 3835f5d1cc
commit 5e9ed59e25
Signed by: DevMiner
GPG key ID: 251708456D625398

67
.github/workflows/docker.yml vendored Normal file
View file

@ -0,0 +1,67 @@
name: Build Docker images
on:
release:
types: [published]
schedule:
- cron: "0 0 * * 0"
pull_request:
push:
branches:
- master
env:
REGISTRY: ghcr.io
IMAGE_NAME: "thedevminertv/ca-list"
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache docker layers
uses: actions/cache@v3
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Gather Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
labels: |
cache-from=type=local,src=/tmp/.buildx-cache
cache-to=type=local,dest=/tmp/.buildx-cache
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache