Spaces:
Sleeping
Sleeping
File size: 854 Bytes
31a6364 4ce7dc8 31a6364 4ce7dc8 587ebe6 31a6364 4ce7dc8 587ebe6 6e9a5be 587ebe6 31a6364 587ebe6 31a6364 |
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 28 29 30 31 32 33 34 35 36 37 38 |
FROM python:3.9-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
# Install system dependencies as root
RUN apt-get update && apt-get install -y \
build-essential \
libsndfile1 \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN useradd -m -u 1000 user
# Switch to the non-root user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Install Python dependencies
COPY --chown=user:users requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -r requirements.txt
# Copy the rest of the project files
COPY --chown=user:users . /app
# Ensure outputs and temp directories exist
RUN mkdir -p outputs temp
# Expose the application port
EXPOSE 7860
# Run the application
CMD ["python", "app.py"] |