NavyDevilDoc/Writing_Assistant
0
1# Use an official lightweight Python image.2FROM python:3.11-slim3 4# Set environment variables5ENV PYTHONDONTWRITEBYTECODE=16ENV PYTHONUNBUFFERED=17 8# Create a non-root user (Recommended for HF Spaces security permissions)9RUN useradd -m -u 1000 user10USER user11ENV PATH="/home/user/.local/bin:$PATH"12 13# Set the working directory in the container14WORKDIR /app15 16# Copy the requirements file first to leverage Docker cache17# Note the --chown flag to ensure the non-root user owns the files18COPY --chown=user ./requirements.txt requirements.txt19 20# Install dependencies21RUN pip install --no-cache-dir --upgrade -r requirements.txt22 23# Copy the rest of the application code24COPY --chown=user . /app25 26# Expose the port strictly required by Hugging Face Spaces27EXPOSE 786028 29# Healthcheck updated to check the correct port30HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 131 32# Command to run the application33# Note the addition of --server.port=786034CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.port=7860", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]