Skip to content

Commit 7f7c20d

Browse files
authored
Egen jobb for å dytte docker image ved release (#145)
Closes #52 Fungerte ikke å blande det med 'kun bygg ved endringer'-oppsettet
1 parent 323cebc commit 7f7c20d

File tree

3 files changed

+44
-5
lines changed

3 files changed

+44
-5
lines changed

.github/workflows/docker-release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish Docker image on release
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
push_to_registries:
8+
runs-on: ubuntu-24.04
9+
matrix:
10+
config:
11+
- {name: base-r}
12+
- {name: dev}
13+
- {name: base-r-alpine}
14+
name: ${{ matrix.config.name }}
15+
steps:
16+
- name: Check out the repo
17+
uses: actions/checkout@v4
18+
- name: Prepare tags
19+
id: docker_meta
20+
uses: docker/metadata-action@v5
21+
with:
22+
images: rapporteket/${{ matrix.config.image }}
23+
tags: |
24+
type=semver,pattern={{version}}
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
- name: Login to DockerHub
28+
uses: docker/login-action@v3
29+
with:
30+
username: ${{ secrets.DOCKERHUB_USERNAME }}
31+
password: ${{ secrets.DOCKERHUB_TOKEN }}
32+
- name: Build and push to Docker Hub
33+
uses: docker/build-push-action@v6
34+
with:
35+
context: ./${{ matrix.config.image }}/.
36+
file: ./${{ matrix.config.image }}/Dockerfile
37+
tags: ${{ steps.docker_meta.outputs.tags }}
38+
labels: ${{ steps.docker_meta.outputs.labels }}
39+
build-args: |
40+
GITHUB_PAT=${{ secrets.GH_TOKEN }}
41+
cache-from: type=gha
42+
cache-to: type=gha,mode=max

.github/workflows/docker.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
name: Publish Docker image
22
on:
3-
release:
4-
types: [published]
53
push:
64
branches:
75
- main
@@ -17,7 +15,7 @@ concurrency:
1715

1816
jobs:
1917
changes:
20-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-24.04
2119
permissions:
2220
pull-requests: read
2321
outputs:
@@ -62,7 +60,6 @@ jobs:
6260
type=ref,event=branch
6361
type=ref,event=pr
6462
type=schedule,pattern=weekly
65-
type=semver,pattern={{version}}
6663
- name: Set up Docker Buildx
6764
uses: docker/setup-buildx-action@v3
6865
- name: Login to DockerHub

.github/workflows/snyk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616

1717
jobs:
1818
snyk:
19-
runs-on: ubuntu-latest
19+
runs-on: ubuntu-24.04
2020
strategy:
2121
fail-fast: false
2222
matrix:

0 commit comments

Comments
 (0)