Skip to content

Commit 9ba5499

Browse files
authored
[feat] publish Docker image to ghcr (#8)
* add Dockerfile * add action for deployment
1 parent affeb7e commit 9ba5499

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

.github/workflows/deploy-image.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Create and publish cnb-tools Docker image upon release
2+
on:
3+
release:
4+
types:
5+
- 'published'
6+
workflow_dispatch: # for testing
7+
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build-and-push-image:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Log in to the Container registry
24+
uses: docker/login-action@v3.0.0
25+
with:
26+
registry: ${{ env.REGISTRY }}
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Extract metadata (tags, labels) for Docker
31+
id: meta
32+
uses: docker/metadata-action@v5.3.0
33+
with:
34+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
35+
36+
- name: Build and push Docker image
37+
uses: docker/build-push-action@v5.1.0
38+
with:
39+
context: .
40+
push: true
41+
tags: ${{ steps.meta.outputs.tags }}
42+
# labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM python:3.12-alpine
2+
3+
WORKDIR /root/cnb-tools
4+
5+
COPY ./ ./
6+
RUN pip install --upgrade pip && \
7+
pip install .
8+
9+
ENTRYPOINT [ "cnb-tools" ]

0 commit comments

Comments
 (0)