Skip to content
This repository was archived by the owner on May 24, 2025. It is now read-only.

Commit 3c0550f

Browse files
committed
#6: added github workflow file
1 parent 7a08f3c commit 3c0550f

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "Build container image"
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- 'main'
12+
13+
env:
14+
REGISTRY: ghcr.io
15+
IMAGE_NAME: ${{ github.repository }}
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v2
27+
28+
# Login against a Docker registry except on PR
29+
# https://github.com/docker/login-action
30+
- name: Log into registry ${{ env.REGISTRY }}
31+
if: github.event_name != 'pull_request'
32+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
33+
with:
34+
registry: ${{ env.REGISTRY }}
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
# Extract metadata (tags, labels) for Docker
39+
# https://github.com/docker/metadata-action
40+
- name: Extract Docker metadata
41+
id: meta
42+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
43+
with:
44+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
45+
46+
# Build and push Docker image with Buildx (don't push on PR)
47+
# https://github.com/docker/build-push-action
48+
- name: Build and push Docker image
49+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
50+
with:
51+
context: .
52+
file: ./docker/Dockerfile
53+
push: ${{ github.event_name != 'pull_request' }}
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)