- app/main.py: root endpoint + /health that reports DB connectivity - app/db.py: pymysql connection check from MYSQL_* env vars, logged at startup - Dockerfile: python:3.12-slim, port 8720 - docker-compose.yml: mysql:8.2 with healthcheck, app waits for DB ready - requirements.txt: fastapi, uvicorn, pymysql Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
11 lines
225 B
Docker
11 lines
225 B
Docker
FROM python:3.12-slim
|
|
|
|
WORKDIR /app
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY app/ ./app/
|
|
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8720", "--log-level", "info"]
|