feat(01-01): create Docker scaffold, FastAPI app shell, and sidebar templates
- Dockerfile with python:3.12-slim-bookworm, curl downloads Pico CSS, HTMX, Alpine.js at build time
- docker-compose.yml with imptune_data:/data named volume and restart policy
- requirements.txt with all phase 1-5 dependencies
- imptune/config.py loading DATA_DIR/PORT from env with DB_PATH and DRIVERS_DIR derived paths
- imptune/main.py: FastAPI app with StaticFiles mount, health+pages routers, startup dir creation
- imptune/api/health.py: GET /health returning {"status": "ok"}
- imptune/api/pages.py: GET / returning dashboard.html with sync def handler
- imptune/templates/base.html: data-theme="auto", sidebar with 5 nav sections, /static/ paths only
- imptune/templates/dashboard.html: quick actions + empty state recent activity
- imptune/static/app.css: sidebar layout, active link highlight, quick action buttons
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
FROM python:3.12-slim-bookworm
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install system deps, download frontend assets, purge curl in one layer
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends curl \
|
||||
&& mkdir -p /app/imptune/static \
|
||||
&& curl -sL --fail -o /app/imptune/static/pico.min.css \
|
||||
"https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css" \
|
||||
&& curl -sL --fail -o /app/imptune/static/htmx.min.js \
|
||||
"https://unpkg.com/htmx.org@2/dist/htmx.min.js" \
|
||||
&& curl -sL --fail -o /app/imptune/static/alpine.min.js \
|
||||
"https://cdn.jsdelivr.net/npm/alpinejs@3/dist/cdn.min.js" \
|
||||
&& apt-get purge -y curl && apt-get autoremove -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY imptune/ /app/imptune/
|
||||
|
||||
VOLUME ["/data"]
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["uvicorn", "imptune.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
Reference in New Issue
Block a user