Skip to content

Commit 1006120

Browse files
committed
Push docker images from main.yaml to GitHub Container Registry
1 parent 93aee57 commit 1006120

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@ on:
99
branches: [ main, dev ]
1010

1111
env:
12-
DOCKER_IMAGE: radarbase/radar-output-restructure
12+
REGISTRY: ghcr.io
13+
REPOSITORY: ${{ github.repository }}
14+
IMAGE_NAME: radar-output-restructure
1315

1416
jobs:
15-
# Build and test the code
1617
build:
17-
# The type of runner that the job will run on
1818
runs-on: ubuntu-latest
1919

20-
# Steps represent a sequence of tasks that will be executed as part of the job
2120
steps:
22-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2321
- uses: actions/checkout@v3
2422

2523
- uses: actions/setup-java@v3
@@ -47,13 +45,17 @@ jobs:
4745

4846
# Check that the docker image builds correctly
4947
docker:
50-
# The type of runner that the job will run on
5148
runs-on: ubuntu-latest
5249

53-
# Steps represent a sequence of tasks that will be executed as part of the job
5450
steps:
55-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
56-
- uses: actions/checkout@v3
51+
- uses: actions/checkout@v4
52+
53+
# Setup docker build environment
54+
- name: Set up QEMU
55+
uses: docker/setup-qemu-action@v3
56+
57+
- name: Set up Docker Buildx
58+
uses: docker/setup-buildx-action@v3
5759

5860
- name: Cache Docker layers
5961
uses: actions/cache@v3
@@ -63,27 +65,25 @@ jobs:
6365
restore-keys: |
6466
${{ runner.os }}-buildx-
6567
68+
- name: Login to Container Registry
69+
uses: docker/login-action@v2
70+
with:
71+
registry: ${{ env.REGISTRY }}
72+
username: ${{ github.actor }}
73+
password: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: Lowercase image name
76+
run: |
77+
echo "DOCKER_IMAGE=${REGISTRY}/${REPOSITORY,,}/${IMAGE_NAME}" >>${GITHUB_ENV}
78+
6679
# Add Docker labels and tags
6780
- name: Docker meta
6881
id: docker_meta
69-
uses: docker/metadata-action@v4
82+
uses: docker/metadata-action@v5
7083
with:
7184
images: ${{ env.DOCKER_IMAGE }}
7285

73-
- name: Login to Docker Hub
74-
uses: docker/login-action@v2
75-
with:
76-
username: ${{ secrets.DOCKERHUB_USERNAME }}
77-
password: ${{ secrets.DOCKERHUB_TOKEN }}
78-
79-
# Setup docker build environment
80-
- name: Set up QEMU
81-
uses: docker/setup-qemu-action@v2
82-
83-
- name: Set up Docker Buildx
84-
uses: docker/setup-buildx-action@v2
85-
86-
- name: Build
86+
- name: Build docker image and push
8787
uses: docker/build-push-action@v3
8888
with:
8989
context: .
@@ -95,8 +95,8 @@ jobs:
9595
# Use runtime labels from docker_meta as well as fixed labels
9696
labels: |
9797
${{ steps.docker_meta.outputs.labels }}
98-
maintainer=Bastiaan de Graaf <bastiaan@thehyve.nl>
99-
org.opencontainers.image.authors=Bastiaan de Graaf <bastiaan@thehyve.nl>
98+
maintainer=Pim van Nierop <pim@thehyve.nl>
99+
org.opencontainers.image.authors=Pim van Nierop <pim@thehyve.nl>
100100
org.opencontainers.image.vendor=RADAR-base
101101
org.opencontainers.image.licenses=Apache-2.0
102102

0 commit comments

Comments
 (0)