Add Docker image, Gitea CI, PyPI publishing and BSD-3-Clause license
Build and publish / test (pull_request) Failing after 40s
Build and publish / cleanup (pull_request) Skipped
Build and publish / build (pull_request) Skipped
Build and publish / pypi (pull_request) Skipped

- Dockerfile builds the npm bundle and serves the app with gunicorn
- Gitea workflow runs tests, tags releases on main, pushes the image to
  the Gitea registry, and publishes to PyPI when PYPI_TOKEN is set
- MANIFEST.in includes the built static bundle in distributions
- License the project under BSD-3-Clause

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shaun Kruger
2026-12-01 23:42:20 -07:00
co-authored by Claude Opus 5.5
parent ba76671795
commit 38f3a0da2f
11 changed files with 406 additions and 3 deletions
+50
View File
@@ -0,0 +1,50 @@
FROM node:24 AS nodebuild
WORKDIR /build
COPY package.json package-lock.json ./
RUN npm ci
COPY webpack.config.js ./
COPY src ./src
COPY privatestudio ./privatestudio
RUN mkdir -p privatestudio/static/bundle && npm run build
FROM python:3.13-slim-trixie
# Version used by setuptools_scm, since .git is not copied into the image.
ARG VERSION=0.0.0
RUN useradd --create-home privatestudio
EXPOSE 8000
ENV PYTHONUNBUFFERED=1 \
PORT=8000 \
DJANGO_SETTINGS_MODULE=privatestudio.settings.production \
STORAGE_PATH=/data/storage
RUN pip install --no-cache-dir "gunicorn~=23.0" "psycopg2-binary~=2.9.11"
WORKDIR /app
COPY --chown=privatestudio:privatestudio . .
COPY --from=nodebuild --chown=privatestudio:privatestudio /build/privatestudio/static/bundle ./privatestudio/static/bundle
RUN SETUPTOOLS_SCM_PRETEND_VERSION="${VERSION}" pip install --no-cache-dir . \
&& mkdir -p /data/storage && chown -R privatestudio:privatestudio /data /app
USER privatestudio
RUN python manage.py collectstatic --noinput --clear
VOLUME ["/data"]
# Migrating at startup keeps "docker run" simple. Use a release step instead if
# you run more than one container against the same database.
CMD set -xe; \
python manage.py migrate --noinput; \
exec gunicorn privatestudio.wsgi:application \
--bind 0.0.0.0:${PORT} \
-k gthread --workers 2 --threads 8 --timeout 600