File size: 569 Bytes
45d4fcd cc16ab1 a6590a4 45d4fcd cc16ab1 a6590a4 cc16ab1 45d4fcd cc16ab1 a6590a4 45d4fcd a6590a4 45d4fcd a6590a4 | 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.9-slim
# Create a non-root user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory to the user's home
WORKDIR $HOME/app
# Copy requirements first for better caching
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Copy the rest of the application
COPY --chown=user . .
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Expose the port Hugging Face Spaces expects
EXPOSE 7860
# Run the application
CMD ["python", "home.py"]
|