chore: consolidate to single Docker container
Replace two-container setup (separate backend + nginx frontend) with a single image that runs both via supervisord: - New Dockerfile: Node stage builds React, Python+nginx stage is the runtime - supervisord.conf: manages uvicorn (api_server.py) + nginx as sibling procs - nginx.conf: proxy_pass updated to localhost:8000 (same container) - docker-compose.yml: simplified to one service on port 80 Deploy: docker-compose up -d # or docker build -t flight-radar . && docker run -p 80:80 flight-radar Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
# Backend Dockerfile for Flight Radar API
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Set environment variables
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy requirements file
|
||||
COPY requirements.txt .
|
||||
|
||||
# Install Python dependencies
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application code
|
||||
COPY api_server.py .
|
||||
COPY airports.py .
|
||||
COPY cache.py .
|
||||
COPY database/ ./database/
|
||||
|
||||
# Create necessary directories
|
||||
RUN mkdir -p data
|
||||
|
||||
# Download airport data on build
|
||||
RUN python -c "from airports import download_and_build_airport_data; download_and_build_airport_data()"
|
||||
|
||||
# Initialize database
|
||||
RUN python database/init_db.py
|
||||
|
||||
# Expose port
|
||||
EXPOSE 8000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD python -c "import requests; requests.get('http://localhost:8000/health').raise_for_status()"
|
||||
|
||||
# Run the application
|
||||
CMD ["python", "api_server.py"]
|
||||
Reference in New Issue
Block a user