- Root docker-compose.yml: backend (python:3.11-slim) + frontend (multi-stage node build -> nginx:alpine) on the newzy-network bridge network, frontend waits for the backend health check - Persistent SQLite via bind mount ./data/db -> /app/data/db - .env / .env.example documenting DATABASE_URL, DEBUG, BACKEND_CORS_ORIGINS and FRONTEND_API_URL - Makefile: dev, stop, restart, build, logs, status, backend-start, frontend-start, test, e2e, shell-backend, shell-frontend, clean - data/.gitignore keeps the data/ structure in git while excluding the database; root .gitignore drops the overly broad data/ rule and adds docker-compose.override.yml - backend: .gitignore covers .env.*, Dockerfile sets unbuffered python and pre-creates the db volume dir; frontend: new .dockerignore - README: full Docker setup docs (prerequisites, quick start, services, ports, network/storage, env vars, Makefile reference, troubleshooting)
30 lines
805 B
Docker
30 lines
805 B
Docker
# newzy backend — FastAPI + SQLite.
|
|
# Orchestration lives in the repository root: docker-compose.yml.
|
|
|
|
FROM python:3.11-slim
|
|
|
|
# Unbuffered logs, no .pyc files in the image, no pip cache.
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PIP_NO_CACHE_DIR=1
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies first to leverage Docker layer caching.
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code (dev-only files excluded by .dockerignore).
|
|
COPY . .
|
|
|
|
# The SQLite database lives on a bind-mounted volume (see docker-compose.yml);
|
|
# ensure the directory exists even before the volume is attached.
|
|
RUN mkdir -p /app/data/db
|
|
VOLUME /app/data/db
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Run application
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|