add docker

This commit is contained in:
Bryan Gerlach
2025-01-23 16:44:17 -06:00
parent 7c7217e1d4
commit d293698e00
7 changed files with 66 additions and 81 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
db.sqlite3

File diff suppressed because one or more lines are too long

26
.github/workflows/docker-build.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: update docker image
on:
push:
branches:
- "master"
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ vars.DOCKERHUB_USERNAME }}/rdgen:latest

13
docker-compose.yml Normal file
View File

@@ -0,0 +1,13 @@
services:
rdgen:
image: bryangerlach/rdgen:latest
restart: unless-stopped
environment:
SECRET_KEY: "django-insecure-!(t-!f#6g#sr%yfded9(xha)g+=!6craeez^cp+*&bz_7vdk61"
GHUSER: "github_username"
GHBEARER: "github_access_token"
GENURL: "accessible_url_of_server"
ports:
- "8000:8000"
dns:
- 8.8.8.8

15
dockerfile Normal file
View File

@@ -0,0 +1,15 @@
FROM python:3.13
WORKDIR /opt/rdgen
COPY . .
RUN python -m venv rdgen
RUN chmod +x rdgen/bin/activate
RUN /bin/sh -c rdgen/bin/activate
RUN pip install --no-cache-dir -r requirements.txt
RUN python manage.py migrate
EXPOSE 8000
CMD ["gunicorn", "-c", "gunicorn.conf.py", "rdgen.wsgi:application"]

9
gunicorn.conf.py Normal file
View File

@@ -0,0 +1,9 @@
import os
# Adjust these values as needed
bind = "0.0.0.0:8000" # Host and port for Gunicorn to listen on
workers = 3 # The number of worker processes for concurrency (adjust based on system resources)
activate_base = True # Activate your virtual environment if applicable
# Path to your Django project's main WSGI application file (usually manage.py)
wsgi_app = "rdgen.wsgi.application"

View File

@@ -1,3 +1,4 @@
django
requests
pillow
pillow
gunicorn