# Use official Python runtime as a parent image FROM python:3.9-slim # Set the working directory in the container WORKDIR /app # Set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 ENV FLASK_APP=src/app.py ENV FLASK_ENV=production # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ libpq-dev \ curl \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the current directory contents into the container at /app COPY . . # Create startup script RUN echo '#!/bin/bash\n\ echo "Setting up database..."\n\ python src/setup_database.py\n\ echo "Starting AI Mockup Service..."\n\ gunicorn --bind 0.0.0.0:8021 src.app:app\n\ ' > /app/start.sh && chmod +x /app/start.sh # Expose the port the app runs on EXPOSE 8021 # Run startup script CMD ["/app/start.sh"]