Skip to content

Commit 07d62bc

Browse files
CopilotSkitionek
andauthored
Add GitHub Actions workflow to build and push Docker images to ghcr.io (#7)
* feat: add GitHub Actions workflow to build and push Docker images to ghcr.io Co-authored-by: Skitionek <22711241+Skitionek@users.noreply.github.com>
1 parent 4dc136d commit 07d62bc

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

.github/workflows/build-images.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Build and Push Docker Images
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- 'v*'
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build:
17+
name: Build ${{ matrix.image }}
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
include:
27+
- image: kg-appserver
28+
context: appserver
29+
30+
- image: kg-webserver
31+
context: client
32+
build-args: |
33+
ANGULAR_CONFIG=production
34+
YARN_INSTALL_OPTS=--frozen-lockfile
35+
36+
- image: kg-statistical-enrichment
37+
context: statistical-enrichment
38+
39+
- image: kg-cache-invalidator
40+
context: cache-invalidator
41+
42+
- image: filebeat
43+
context: filebeat
44+
45+
- image: elasticsearch
46+
context: elasticsearch
47+
48+
- image: logstash
49+
context: logstash
50+
51+
- image: metricbeat
52+
context: metricbeat
53+
54+
- image: arangodb
55+
context: arangodb
56+
57+
- image: graph-db-migrator
58+
context: graph-db/migrator
59+
60+
steps:
61+
- name: Checkout repository
62+
uses: actions/checkout@v4
63+
64+
- name: Set up Docker Buildx
65+
uses: docker/setup-buildx-action@v3
66+
67+
- name: Log in to GitHub Container Registry
68+
uses: docker/login-action@v3
69+
with:
70+
registry: ghcr.io
71+
username: ${{ github.actor }}
72+
password: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: Extract Docker metadata
75+
id: meta
76+
uses: docker/metadata-action@v5
77+
with:
78+
images: ghcr.io/${{ github.repository }}/${{ matrix.image }}
79+
tags: |
80+
type=sha,prefix=,format=short
81+
type=ref,event=branch
82+
type=semver,pattern={{version}}
83+
type=semver,pattern={{major}}.{{minor}}
84+
type=raw,value=latest,enable={{is_default_branch}}
85+
86+
- name: Build and push Docker image
87+
uses: docker/build-push-action@v5
88+
with:
89+
context: ${{ matrix.context }}
90+
push: true
91+
tags: ${{ steps.meta.outputs.tags }}
92+
labels: ${{ steps.meta.outputs.labels }}
93+
build-args: ${{ matrix.build-args }}
94+
cache-from: type=gha,scope=${{ matrix.image }}
95+
cache-to: type=gha,mode=max,scope=${{ matrix.image }}

0 commit comments

Comments
 (0)