# Use an official Python runtime as a parent image with Python 3.10 | |
FROM python:3.10-slim | |
# Create a non-root user and change ownership | |
RUN useradd -m -u 1000 user | |
WORKDIR /app | |
COPY --chown=user . /app | |
# Install any needed packages specified in requirements.txt | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Make port 7860 available to the world outside this container | |
EXPOSE 7860 | |
# Define environment variable | |
ENV FLASK_APP=app | |
ENV FLASK_RUN_HOST=0.0.0.0 | |
ENV FLASK_RUN_PORT=7860 | |
ENV FLASK_ENV=development | |
# Run flask command when the container launches | |
CMD ["flask", "run"] |