add dockerfile and gitea workflow

This commit is contained in:
2025-10-24 10:51:10 +02:00
parent 2eda108577
commit 5ee2156288
2 changed files with 63 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
name: Build and Push Docker Container
on:
push:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: '${{ secrets.ACTION_ACCESS_TOKEN }}'
submodules: recursive
lfs: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Gitea Registry
uses: docker/login-action@v3
with:
registry: ${{ vars.DOCKER_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.ACTION_ACCESS_TOKEN }}
- name: Repo owner to lowercase (for Gitea namespace)
run: echo "REPO_OWNER_LC=$(echo '${{ gitea.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Build and push Docker image for latest tag
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ vars.DOCKER_REGISTRY_URL }}/${{ env.REPO_OWNER_LC }}/simple-nanoshare:latest
platforms: linux/amd64
- name: Invoke Portainer Stack Deployment
if: ${{ vars.PORTAINER_STACK_WEBHOOK_URL && vars.PORTAINER_STACK_WEBHOOK_URL != '' }}
uses: distributhor/workflow-webhook@v3
with:
webhook_url: ${{ vars.PORTAINER_STACK_WEBHOOK_URL }}
+19
View File
@@ -0,0 +1,19 @@
FROM python:3.13-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libssl-dev && \
rm -rf /var/lib/apt/lists/*
# Install app
COPY . /app
WORKDIR /app
# Install dependencies
RUN pip install --upgrade pip && \
pip install --root-user-action=ignore -r requirements.txt
EXPOSE 8000
# Starten Sie Ihre Anwendung
CMD ["hypercorn", "run:app", "--bind", "0.0.0.0:8000", "--workers", "1", "--websocket-ping-interval", "20", "--access-logfile", "-"]