nanee-convo / Dockerfile
ygauravyy's picture
Update Dockerfile
587ebe6 verified
raw
history blame contribute delete
854 Bytes
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"]