fix: add Dockerfile and gitea ci pipeline
This commit is contained in:
46
.gitea/workflows/publish-docker.yml
Normal file
46
.gitea/workflows/publish-docker.yml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
name: Build and Publish Docker Image
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Log in to Gitea Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: git.br0tkasten.de
|
||||||
|
username: ${{ gitea.actor }}
|
||||||
|
# access token of the user triggering this action
|
||||||
|
# in gitea -> user settings -> applications -> new token -> write:packages and write:repositories
|
||||||
|
# then in gitea -> user settings -> actions -> secrets -> add new secret named "TOKEN" with the value of the access token.
|
||||||
|
password: ${{ secrets.TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: git.br0tkasten.de/${{ gitea.repository }}
|
||||||
|
flavor: |
|
||||||
|
latest=true
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=sha
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Use an official Python runtime as a parent image
|
||||||
|
FROM python:3-slim
|
||||||
|
|
||||||
|
# Set the working directory in the container
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy the requirements file into the container
|
||||||
|
COPY requirements.txt .
|
||||||
|
|
||||||
|
# Install any needed packages specified in requirements.txt
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# Copy the current directory contents into the container at /app
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Make port 9080 available to the world outside this container
|
||||||
|
EXPOSE 9080
|
||||||
|
|
||||||
|
# Run the application using Gunicorn
|
||||||
|
CMD ["python3", "app.py"]
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
BASE=$(dirname $0)
|
|
||||||
cd $BASE
|
|
||||||
git pull
|
|
||||||
if [ -d env ];
|
|
||||||
then
|
|
||||||
python3 -m venv env
|
|
||||||
fi
|
|
||||||
|
|
||||||
source env/bin/activate
|
|
||||||
pip3 install -U -r requirements.txt
|
|
||||||
exec python3 app.py
|
|
||||||
@@ -1 +1 @@
|
|||||||
websockets
|
websockets
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/sbin/openrc-run
|
|
||||||
|
|
||||||
name="scratch-cloudvars-server"
|
|
||||||
command="/data/entrypoint.sh"
|
|
||||||
pidfile="/var/run/$SVCNAME.pid"
|
|
||||||
command_background="yes"
|
|
||||||
output_logger="/usr/bin/logger"
|
|
||||||
error_logger="/usr/bin/logger"
|
|
||||||
|
|
||||||
depend() {
|
|
||||||
need net
|
|
||||||
use logger
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user