Skip to content

Commit dc7949a

Browse files
committed
feat: Add Docker workflow and Dockerfile
1 parent a5a51c1 commit dc7949a

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

.github/workflows/docker.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Create and publish a Docker image
2+
3+
# Configures this workflow to run every time a change is pushed to the branch called `master`.
4+
on:
5+
release:
6+
types: ['published']
7+
8+
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
14+
jobs:
15+
build-and-push-image:
16+
runs-on: ubuntu-latest
17+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
18+
permissions:
19+
contents: read
20+
packages: write
21+
attestations: write
22+
id-token: write
23+
#
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
28+
- name: Log in to the Container registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
35+
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
36+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
37+
- name: Build and push Docker image
38+
id: push
39+
uses: docker/build-push-action@v6
40+
with:
41+
context: .
42+
push: true
43+
tags: ${{ github.ref_name }}

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Use official Python slim image
2+
FROM python:3.12-slim
3+
4+
# Set workdir
5+
WORKDIR /app
6+
7+
# Copy dependencies list and install them
8+
COPY requirements.txt .
9+
RUN pip install --no-cache-dir -r requirements.txt
10+
11+
# Copy the python script
12+
COPY moddb_comment_notifier.py .
13+
14+
# Set default command to run your notifier
15+
CMD ["python", "-u", "moddb_comment_notifier.py"]

compose.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
services:
2+
moddb-comment-notifier:
3+
image: ghcr.io/tosox/moddb-comment-notifier:latest
4+
restart: always
5+
volumes:
6+
- /srv/moddb-comment-notifier:/app

0 commit comments

Comments
 (0)