Skip to content

Commit 933ef5c

Browse files
author
Dimitris
committed
👷 Adds github registry builds
1 parent db04afa commit 933ef5c

1 file changed

Lines changed: 37 additions & 23 deletions

File tree

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,53 @@
1-
name: docker-builds
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
name: Create and publish a Docker image
27

38
on:
4-
push:
5-
branches:
6-
- '**'
79
release:
810
types: [published]
911

12+
env:
13+
REGISTRY: ghcr.io
14+
IMAGE_NAME: ${{ github.repository }}
15+
1016
jobs:
11-
docker:
17+
build-and-push-image:
1218
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
1323
steps:
14-
- name: Checkout
24+
- name: Checkout repository
1525
uses: actions/checkout@v2
16-
- name: Docker meta
17-
id: docker_meta
18-
uses: crazy-max/ghaction-docker-meta@v1
19-
with:
20-
images: dstrants/backups_web
26+
2127
- name: Set up QEMU
2228
uses: docker/setup-qemu-action@v1
29+
2330
- name: Set up Docker Buildx
2431
uses: docker/setup-buildx-action@v1
25-
- name: Login to DockerHub
26-
if: github.event_name == 'release'
27-
uses: docker/login-action@v1
32+
33+
- name: Log in to the Container registry
34+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
2835
with:
29-
username: ${{ secrets.DOCKERHUB_USERNAME }}
30-
password: ${{ secrets.DOCKERHUB_TOKEN }}
31-
- name: Build and push
32-
uses: docker/build-push-action@v2
36+
registry: ${{ env.REGISTRY }}
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Extract metadata (tags, labels) for Docker
41+
id: meta
42+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
43+
with:
44+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
45+
46+
- name: Build and push Docker image
47+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
3348
with:
3449
context: .
35-
file: ./Dockerfile
36-
platforms: linux/amd64
37-
push: ${{ github.event_name == 'release' }}
38-
tags: ${{ steps.docker_meta.outputs.tags }}
39-
labels: ${{ steps.docker_meta.outputs.labels }}
50+
push: true
51+
platforms: linux/amd64,linux/arm64
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)