Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copy this file to .env and adjust values as needed
# Database selection: sqlite (default), postgres, mysql
DATABASE=sqlite

# Common Django settings
DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1
DJANGO_SECRET_KEY=app-secret_key
WAGTAIL_SITE_NAME=wagtail-starter-kit
WAGTAILADMIN_BASE_URL=http://localhost:8000
DEBUG=false

# MySQL settings (used when DATABASE=mysql)
MYSQL_HOST=db
MYSQL_PORT=3306
MYSQL_DATABASE=app
MYSQL_USER=app
MYSQL_PASSWORD=app
MYSQL_ROOT_PASSWORD=app
MYSQL_ROOT_HOST=%

# PostgreSQL settings (used when DATABASE=postgres)
POSTGRES_HOST=db
POSTGRES_PORT=5432
POSTGRES_DB=app
POSTGRES_USER=app
POSTGRES_PASSWORD=app
56 changes: 0 additions & 56 deletions .github/workflows/claude-code-review.yml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/claude.yml

This file was deleted.

19 changes: 7 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,14 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 25.1.0 # Keep in sync with locked version
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 7.0.0 # Keep in sync with locked version
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/pycqa/flake8
rev: 7.3.0 # Keep in sync with locked version
hooks:
- id: flake8
# Run the linter
- id: ruff
args: [--fix]
# Run the formatter
- id: ruff-format
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.2 # Keep in sync with locked version
hooks:
Expand Down
65 changes: 47 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20
FROM node:24

COPY package.json package-lock.json ./
RUN npm install
Expand All @@ -7,14 +7,14 @@ COPY ./static_src/ ./static_src/
COPY ./scripts/ ./scripts/
RUN npm run build

# Use an official Python runtime based on Debian 10 "buster" as a parent image.
FROM python:3.10-bookworm
# Use the uv image (slim) with Python 3.10 on Debian bookworm.
FROM ghcr.io/astral-sh/uv:python3.10-bookworm-slim

# Sets the database module to be used, if not using SQLite.
ARG DBMODULE

# Add user that will be used in the container.
RUN useradd wagtail
RUN useradd -m wagtail

# Port used by this container to serve HTTP.
EXPOSE 8000
Expand All @@ -27,42 +27,71 @@ ENV PYTHONUNBUFFERED=1 \
PORT=8000 \
DBMODULE=${DBMODULE}

# Install system packages required by Wagtail and Django.
# Install runtime system libraries required by Wagtail/Django and Pillow.
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
libpq5 \
libjpeg62-turbo \
zlib1g \
libwebp7 \
libmariadb3 \
&& rm -rf /var/lib/apt/lists/*

# Prepare app workspace and install Python deps using uv from pyproject.
WORKDIR /app
COPY pyproject.toml uv.lock ./
ENV UV_NO_DEV=1 \
UV_LINK_MODE=copy \
UV_PYTHON_CACHE_DIR=/root/.cache/uv/python

# Temporarily install build tools and headers to allow building wheels, then purge.
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
build-essential \
pkg-config \
libpq-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
libwebp-dev \
default-libmysqlclient-dev
RUN --mount=type=cache,target=/root/.cache/uv \
uv python install

# Install project dependencies into system Python using the lockfile
RUN --mount=type=cache,target=/root/.cache/uv \
uv export --locked --no-dev --no-hashes --output-file /tmp/requirements.txt && \
UV_SYSTEM_PYTHON=1 uv pip install --system -r /tmp/requirements.txt

# Optional DB driver installation (ensure build deps present before purge)
RUN if [ -n "$DBMODULE" ]; then echo "Installing DB module: $DBMODULE" && $DBMODULE; else echo "No DBMODULE specified"; fi

# Remove build-only packages to slim the final image.
RUN apt-get purge --yes --quiet \
build-essential \
libpq-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
libwebp-dev \
&& apt-get autoremove --yes --quiet --purge \
&& rm -rf /var/lib/apt/lists/*

# Install the application server.
# RUN pip install "gunicorn==20.0.4"
# Use system Python at runtime; no virtualenv activation required.

# Install the project requirements.
COPY requirements.txt /
RUN pip install -U pip && pip install -r /requirements.txt
RUN ${DBMODULE}

# Use /app folder as a directory where the source code is stored.
WORKDIR /app

COPY --from=0 ./static_compiled ./static_compiled

# Set this directory to be owned by the "wagtail" user. This Wagtail project
# uses SQLite, the folder needs to be owned by the user that
# will be writing to the database file.
RUN chown wagtail:wagtail /app
RUN chown -R wagtail:wagtail /app

# Copy the source code of the project into the container.
COPY --chown=wagtail:wagtail . .

# Use user "wagtail" to run the build commands below and the server itself.
USER wagtail

# Collect static files.
# Collect static files using system Python (run as root).
RUN python manage.py collectstatic --noinput --clear

# Switch to non-root user for runtime.
USER wagtail
# Runtime command that executes when "docker run" is called, it does the
# following:
# 1. Migrate the database.
Expand Down
Loading