Skip to content

Commit feb760f

Browse files
add github actions
1 parent 992bab9 commit feb760f

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/docker.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build Docker Images
2+
on:
3+
release:
4+
types: [published]
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
IMAGE_NAME_PREFIX: ${{ github.repository }}
9+
10+
jobs:
11+
build-and-push-images:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
strategy:
18+
matrix:
19+
app: [api, queue, dashboard]
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v3
24+
25+
- name: Log in to the Container registry
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Extract metadata (tags, labels) for Docker
33+
id: meta
34+
uses: docker/metadata-action@v5
35+
with:
36+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_PREFIX}}-${{matrix.app}}
37+
38+
- name: GET DockerFile Path
39+
run: |
40+
DOCKERFILE_PATH=$(if [ "${{ matrix.app }}" == "dashboard" ]; then echo "./dashboard/Dockerfile"; else echo "Dockerfile.${{ matrix.app }}"; fi)
41+
echo "DOCKERFILE_PATH=$DOCKERFILE_PATH" >> $GITHUB_ENV
42+
- name: Build and push Docker image
43+
uses: docker/build-push-action@v5
44+
with:
45+
context: .
46+
file: ${{ env.DOCKERFILE_PATH }}
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}
50+
build-args: |
51+
"REPO=${{ github.repository }}"

0 commit comments

Comments
 (0)