Spaces:
Sleeping
Sleeping
File size: 912 Bytes
4ce7dc8 6e9a5be 4ce7dc8 6e9a5be 4ce7dc8 6e9a5be |
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 39 40 41 42 |
FROM python:3.9-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PORT=8080
# Create a non-root user
RUN useradd -m -u 1000 user
# Switch to root for system installations
USER root
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libsndfile1 \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Switch back to non-root user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Copy requirements and 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 port 8080
EXPOSE 8080
# Run the application
CMD ["python", "app.py"]
|