Skip to content

Commit f630df6

Browse files
committed
feat: Docker buld and push
- Build docker image - Push it to ghcr.io
1 parent e672463 commit f630df6

3 files changed

Lines changed: 56 additions & 1 deletion

File tree

.github/workflows/build.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "Build"
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
tags:
8+
- 'v*'
9+
10+
env:
11+
# Use docker.io for Docker Hub if empty
12+
REGISTRY: ghcr.io
13+
# GitHub repository as <account>/<repo>
14+
IMAGE_NAME: ${{ github.repository }}
15+
16+
jobs:
17+
docker:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
23+
- name: Login to ${{ env.REGISTRY }}
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ${{ env.REGISTRY }}
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Set up QEMU
31+
uses: docker/setup-qemu-action@v3
32+
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v3
35+
36+
- name: Extract Docker metadata
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
tags: |
42+
type=sha,format=long
43+
type=semver,pattern={{version}}
44+
type=semver,pattern={{major}}.{{minor}}
45+
flavor: |
46+
latest=false
47+
48+
- name: Build and push
49+
uses: docker/build-push-action@v6
50+
with:
51+
context: .
52+
push: true
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ COPY ./pyproject.toml ./poetry.lock /code/
2323
RUN poetry install --no-interaction --no-root --only=main
2424

2525
ARG BUILD_COMMIT_SHA
26-
ENV BUILD_COMMIT_SHA ${BUILD_COMMIT_SHA:-}
26+
ENV BUILD_COMMIT_SHA=${BUILD_COMMIT_SHA:-}
2727

2828
#RUN if [ "${BUILD_COMMIT_SHA}" = "localdev" ]; then \
2929
# poetry install --no-interaction --no-root --only=dev; \

compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ services:
1717
#]
1818
environment:
1919
- AUTHENTIK_TOKEN
20+
- API_KEY

0 commit comments

Comments
 (0)