refactor: split back into two containers (backend + frontend)
Single-container supervisord approach added unnecessary complexity. Two containers is simpler and more standard: - Dockerfile.backend: python:3.11-slim, uvicorn on port 8000 - Dockerfile.frontend: node build → nginx:alpine on port 80 - nginx.conf: proxy_pass restored to http://backend:8000 - docker-compose.yml: two services with depends_on - Removed combined Dockerfile and supervisord.conf Each container does one thing; logs are separate; either can be restarted independently. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
30
flight-comparator/Dockerfile.backend
Normal file
30
flight-comparator/Dockerfile.backend
Normal file
@@ -0,0 +1,30 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY api_server.py airports.py cache.py ./
|
||||
COPY database/ ./database/
|
||||
|
||||
# Pre-fetch airport data and initialise the database at build time
|
||||
RUN mkdir -p data && \
|
||||
python -c "from airports import download_and_build_airport_data; download_and_build_airport_data()" && \
|
||||
python database/init_db.py
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
|
||||
|
||||
CMD ["python", "api_server.py"]
|
||||
Reference in New Issue
Block a user