Scaffold Phase 0: Django project, deploy config, base layout
Django 5.2 with dev/test/prod settings, SQLite tuned for Litestream
(WAL, IMMEDIATE transactions), ULID primary keys via a shared base
model, and a custom User model ahead of the first migration.
Minimal accessible base template with dark mode via color-scheme and
an optional theme picker. /healthz answers before host validation so
Fly checks pass.
Dockerfile (dev and prod targets), compose for local dev, fly.toml
with placeholder app/region, Litestream backups to B2, and a Forgejo
Actions workflow. Migrations run in bin/start because Fly release
machines don't mount volumes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 06:59:34 -04:00
|
|
|
# syntax=docker/dockerfile:1
|
|
|
|
|
|
|
|
|
|
FROM python:3.13-slim-trixie AS base
|
|
|
|
|
COPY --from=ghcr.io/astral-sh/uv:0.13.6 /uv /usr/local/bin/uv
|
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
|
|
|
UV_COMPILE_BYTECODE=1 \
|
|
|
|
|
UV_LINK_MODE=copy \
|
|
|
|
|
UV_PYTHON_DOWNLOADS=never \
|
|
|
|
|
# Outside /app so the compose bind mount doesn't hide it.
|
|
|
|
|
UV_PROJECT_ENVIRONMENT=/opt/venv \
|
|
|
|
|
PATH="/opt/venv/bin:$PATH"
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FROM base AS dev
|
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
|
|
|
--mount=type=bind,source=uv.lock,target=uv.lock \
|
|
|
|
|
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
|
|
|
|
uv sync --locked --no-install-project
|
|
|
|
|
ENV DJANGO_SETTINGS_MODULE=config.settings.dev
|
|
|
|
|
CMD ["sh", "-c", "python manage.py migrate --noinput && python manage.py runserver 0.0.0.0:8000"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FROM base AS prod
|
|
|
|
|
COPY --from=litestream/litestream:0.5.17 /usr/local/bin/litestream /usr/local/bin/litestream
|
2026-10-27 08:42:19 -04:00
|
|
|
# The app runs as this user; bin/start drops to it after making the data volume writable.
|
|
|
|
|
RUN useradd --system --uid 1000 --create-home app
|
Scaffold Phase 0: Django project, deploy config, base layout
Django 5.2 with dev/test/prod settings, SQLite tuned for Litestream
(WAL, IMMEDIATE transactions), ULID primary keys via a shared base
model, and a custom User model ahead of the first migration.
Minimal accessible base template with dark mode via color-scheme and
an optional theme picker. /healthz answers before host validation so
Fly checks pass.
Dockerfile (dev and prod targets), compose for local dev, fly.toml
with placeholder app/region, Litestream backups to B2, and a Forgejo
Actions workflow. Migrations run in bin/start because Fly release
machines don't mount volumes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 06:59:34 -04:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
|
|
|
--mount=type=bind,source=uv.lock,target=uv.lock \
|
|
|
|
|
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
|
|
|
|
uv sync --locked --no-install-project --no-dev
|
|
|
|
|
COPY litestream.yml /etc/litestream.yml
|
|
|
|
|
COPY . .
|
2026-10-27 08:42:19 -04:00
|
|
|
# Placeholder settings: collectstatic needs the prod settings to import, nothing more.
|
Scaffold Phase 0: Django project, deploy config, base layout
Django 5.2 with dev/test/prod settings, SQLite tuned for Litestream
(WAL, IMMEDIATE transactions), ULID primary keys via a shared base
model, and a custom User model ahead of the first migration.
Minimal accessible base template with dark mode via color-scheme and
an optional theme picker. /healthz answers before host validation so
Fly checks pass.
Dockerfile (dev and prod targets), compose for local dev, fly.toml
with placeholder app/region, Litestream backups to B2, and a Forgejo
Actions workflow. Migrations run in bin/start because Fly release
machines don't mount volumes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 06:59:34 -04:00
|
|
|
RUN DJANGO_SETTINGS_MODULE=config.settings.prod DJANGO_SECRET_KEY=collectstatic \
|
2026-10-27 08:42:19 -04:00
|
|
|
EMAIL_BACKEND=django.core.mail.backends.dummy.EmailBackend \
|
Scaffold Phase 0: Django project, deploy config, base layout
Django 5.2 with dev/test/prod settings, SQLite tuned for Litestream
(WAL, IMMEDIATE transactions), ULID primary keys via a shared base
model, and a custom User model ahead of the first migration.
Minimal accessible base template with dark mode via color-scheme and
an optional theme picker. /healthz answers before host validation so
Fly checks pass.
Dockerfile (dev and prod targets), compose for local dev, fly.toml
with placeholder app/region, Litestream backups to B2, and a Forgejo
Actions workflow. Migrations run in bin/start because Fly release
machines don't mount volumes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 06:59:34 -04:00
|
|
|
python manage.py collectstatic --noinput
|
|
|
|
|
ENV DJANGO_SETTINGS_MODULE=config.settings.prod
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
CMD ["bin/start"]
|