# Use an official Python runtime as a parent image FROM python:3.9 # Create a non-root user with a home directory RUN useradd -m -u 1000 user # Set the user to the non-root user USER user # Add the user's local bin to the PATH ENV PATH="/home/user/.local/bin:$PATH" # Set the working directory to /app WORKDIR /app # Copy the requirements.txt file and install any dependencies COPY --chown=user ./requirements.txt /app/requirements.txt RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt # Copy the current directory contents into the container at /app COPY --chown=user . /app # Create the folders for uploads and results with appropriate permissions RUN mkdir -p /app/static/uploads /app/static/results && \ chmod -R 755 /app/static/uploads /app/static/results # Expose the port the app will run on EXPOSE 7860 # Run the Flask app using uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]