Perilon's picture
Fix authentication and port issues for Hugging Face Spaces
9ea00c9
raw
history blame
603 Bytes
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Create a user for running the app
RUN useradd -m -u 1000 user
RUN apt-get update && apt-get install -y ffmpeg wget git && apt-get clean
RUN mkdir -p /home/user && chown -R user:user /home/user
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
ENV HOME=/home/user
# Copy app files
COPY . .
RUN chown -R user:user /app
# Switch to non-root user
USER user
# Expose the port the app runs on
EXPOSE 7860
CMD ["python", "flask_app.py", "--host", "0.0.0.0", "--port", "7860"]