Add UI and styling documentation; remove idempotency and logging audits
Some checks failed
CI / test (pull_request) Failing after 1m8s

- Introduced a new document outlining UI structure, reusable template components, CSS variable conventions, and per-page data/actions for the CalMiner application.
- Removed outdated idempotency audit and logging audit documents as they are no longer relevant.
- Updated quickstart guide to streamline developer setup instructions and link to relevant documentation.
- Created a roadmap document detailing scenario enhancements and data management strategies.
- Deleted the seed data plan document to consolidate information into the setup process.
- Refactored setup_database.py for improved logging and error handling during database setup and migration processes.
This commit is contained in:
2025-10-29 13:20:44 +01:00
parent 1f58de448c
commit 04d7f202b6
19 changed files with 609 additions and 752 deletions

View File

@@ -1,35 +1,113 @@
# Multi-stage Dockerfile to keep final image small
FROM python:3.10-slim AS builder
# syntax=docker/dockerfile:1.7
# Install build-time packages and Python dependencies in one layer
WORKDIR /app
COPY requirements.txt /app/requirements.txt
RUN echo 'Acquire::http::Proxy "http://192.168.88.14:3142";' > /etc/apt/apt.conf.d/90proxy
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential gcc libpq-dev \
&& python -m pip install --upgrade pip \
&& pip install --no-cache-dir --prefix=/install -r /app/requirements.txt \
&& apt-get purge -y --auto-remove build-essential gcc \
&& rm -rf /var/lib/apt/lists/*
ARG PYTHON_VERSION=3.11-slim
ARG APT_CACHE_URL=http://192.168.88.14:3142
ARG UVICORN_WORKERS=4
ARG UVICORN_PORT=8000
FROM python:${PYTHON_VERSION} AS builder
ARG APT_CACHE_URL
ENV \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
FROM python:3.10-slim
WORKDIR /app
# Copy installed packages from builder
COPY --from=builder /install /usr/local
COPY requirements.txt ./requirements.txt
# Assume environment variables for DB config will be set at runtime
# ENV DATABASE_HOST=your_db_host
# ENV DATABASE_PORT=your_db_port
# ENV DATABASE_NAME=your_db_name
# ENV DATABASE_USER=your_db_user
# ENV DATABASE_PASSWORD=your_db_password
RUN --mount=type=cache,target=/root/.cache/pip /bin/bash <<'EOF'
set -e
python3 <<'PY'
import os, socket, urllib.parse
url = os.environ.get('APT_CACHE_URL', '').strip()
if url:
parsed = urllib.parse.urlparse(url)
host = parsed.hostname
port = parsed.port or (80 if parsed.scheme == 'http' else 443)
if host:
sock = socket.socket()
sock.settimeout(1)
try:
sock.connect((host, port))
except OSError:
pass
else:
with open('/etc/apt/apt.conf.d/01proxy', 'w', encoding='utf-8') as fh:
fh.write(f"Acquire::http::Proxy \"{url}\";\n")
fh.write(f"Acquire::https::Proxy \"{url}\";\n")
finally:
sock.close()
PY
apt-get update
apt-get install -y --no-install-recommends build-essential gcc libpq-dev
pip install --upgrade pip
pip wheel --no-deps --wheel-dir /wheels -r requirements.txt
apt-get purge -y --auto-remove build-essential gcc
rm -rf /var/lib/apt/lists/*
EOF
FROM python:${PYTHON_VERSION} AS runtime
ARG APT_CACHE_URL
ENV \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PATH="/home/appuser/.local/bin:${PATH}"
WORKDIR /app
RUN groupadd --system app && useradd --system --create-home --gid app appuser
RUN /bin/bash <<'EOF'
set -e
python3 <<'PY'
import os, socket, urllib.parse
url = os.environ.get('APT_CACHE_URL', '').strip()
if url:
parsed = urllib.parse.urlparse(url)
host = parsed.hostname
port = parsed.port or (80 if parsed.scheme == 'http' else 443)
if host:
sock = socket.socket()
sock.settimeout(1)
try:
sock.connect((host, port))
except OSError:
pass
else:
with open('/etc/apt/apt.conf.d/01proxy', 'w', encoding='utf-8') as fh:
fh.write(f"Acquire::http::Proxy \"{url}\";\n")
fh.write(f"Acquire::https::Proxy \"{url}\";\n")
finally:
sock.close()
PY
apt-get update
apt-get install -y --no-install-recommends libpq5
rm -rf /var/lib/apt/lists/*
EOF
COPY --from=builder /wheels /wheels
COPY --from=builder /app/requirements.txt /tmp/requirements.txt
RUN pip install --upgrade pip \
&& pip install --no-cache-dir --find-links=/wheels -r /tmp/requirements.txt \
&& rm -rf /wheels /tmp/requirements.txt
# Copy application code
COPY . /app
# Expose service port
RUN chown -R appuser:app /app
USER appuser
EXPOSE 8000
# Run the FastAPI app with uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "${UVICORN_PORT}", "--workers", "${UVICORN_WORKERS}"]