Trae Assistant
优化
779c78b
Raw
History Blame Contribute Delete
615 Bytes
FROM python:3.9-slim
# Prevent Python from writing pyc files to disc
ENV PYTHONDONTWRITEBYTECODE=1
# Prevent Python from buffering stdout and stderr
ENV PYTHONUNBUFFERED=1
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Create instance directory and fix permissions
# We use chmod 777 to allow the non-root user (or any user HF assigns) to write to it
RUN mkdir -p instance && chmod 777 instance
# Create a non-root user
RUN useradd -m -u 1000 user
# Switch to the non-root user
USER user
EXPOSE 7860
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]