# Use an official Python runtime as a parent image
FROM python:slim-bullseye

# Set the working directory to /app
WORKDIR /backend

# Copy the code into the container
COPY ./ /backend

# Install any dependencies specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Expose port 5000 for the Flask application
EXPOSE 5000

# Set the environment variables required by the Flask application
ENV FLASK_APP=app.py
ENV FLASK_ENV=production

# Run the Python script that provides the Flask API
CMD ["flask", "run", "--host=0.0.0.0"]
