dockerise

This commit is contained in:
Corban-Lee Jones 2024-08-13 23:10:34 +01:00
parent 462f0e2af8
commit 7ae0a99a09
4 changed files with 71 additions and 1 deletions

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
.gitea/
.vscode/
logs/
__pycache__/
.env
.git/

46
.gitea/docker.build.yaml Normal file
View File

@ -0,0 +1,46 @@
name: Build and Push Docker Image
run-name: ${{ gitea.actor }} is building and pushing a Docker Image
on:
push:
branches:
- master
- staging
- dev
pull_request:
branches:
- master
- staging
- dev
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set Docker tag based on branch
id: tag
run: |
if [[ "${{ gitea.ref_name }}" == "master" ]]; then
TAG="latest"
elif [[ "${{ gitea.ref_name }}" == "staging" ]]; then
TAG="staging"
elif [[ "${{ gitea.ref_name }}" == "dev" ]]; then
TAG="dev"
fi
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Build Docker image
run: |
docker build -t pyrss-bot:${{ env.TAG }} .
- name: Login to Docker registry
run: echo ${{ secrets.DOCKER_TOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Tag & Push Docker image
run: |
docker tag pyrss-bot:${{ env.TAG }} xordk/pyrss-bot:${{ env.TAG }}
docker push xordk/pyrss-bot:${{ env.TAG }}

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM python:3.11.4-slim-buster
# python related environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
WORKDIR /app
# install python dependencies
COPY requirements.txt /app/
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
COPY . /app/
CMD ["python", "src/main.py"]

View File

@ -4,4 +4,6 @@ An RSS driven Discord bot written in Python.
Provides user commands for storing RSS feed URLs that can be assigned to any given discord channel.
Content is shared every 10 minutes as an Embed.
Content is shared every 10 minutes as an Embed.
Depends on the web server app.