Spaces:
Sleeping
Sleeping
File size: 792 Bytes
48ca2cf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
FROM python:3.11
# Set DEBIAN_FRONTEND to noninteractive to avoid prompts during apt-get install
ENV DEBIAN_FRONTEND=noninteractive
# --- User Setup ---
# Create a non-root user and switch to it
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# --- Python Package Installation (as user) ---
# Copy only requirements.txt first to leverage Docker cache
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# --- Application Code ---
# Copy the rest of the application code
COPY --chown=user . /app
# --- Run Command ---
# Expose the port the app runs on (optional but good practice)
EXPOSE 7860
# Start the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |