FROM python:3.10-alpine AS final

WORKDIR /app

# Copy only installed dependencies + app
COPY --from=builder /install /usr/local
COPY --from=builder /app /app

# Production ENV
ENV FLASK_ENV=production
ENV FLASK_APP=run.py
ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_RUN_PORT=5000

EXPOSE 5000

# Use Gunicorn for production
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "run:app"]
