Spaces:
Running
Running
# Use Python 3.11 as the base image | |
FROM python:3.11 | |
# Create a non-root user | |
RUN useradd -m -u 1000 user | |
USER user | |
# Set the environment path for pip packages | |
ENV PATH="/home/user/.local/bin:$PATH" | |
# Set working directory | |
WORKDIR /server | |
# Copy and install dependencies | |
COPY --chown=user requirements.txt requirements.txt | |
RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
# Copy all files to the container | |
COPY --chown=user . /server | |
# Expose Flask port | |
EXPOSE 7860 | |
# Run Flask app | |
CMD ["python", "server.py"] | |