Spaces:
Runtime error

zenith / Dockerfile
hello-yaaash25's picture
Refactor Dockerfile to expose port 8080 and run Chainlit in headless mode
f8aa045
Raw History Blame Contribute Delete
845 Bytes
FROM python:3.10-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git curl \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install -r requirements.txt
# Create necessary directories and set permissions
RUN mkdir -p /app/.files /app/.cache /app/.chainlit
RUN chmod 777 /app/.files /app/.cache /app/.chainlit
# Copy application code
COPY . .
# Set environment variables
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
ENV HOST_URL=https://hello-yaaash25-zenith.hf.space
# Expose port 8080
EXPOSE 8080
# Run as non-root user for better security
RUN useradd -m chainlit
RUN chown -R chainlit:chainlit /app
USER chainlit
# Use HTTPS mode to handle WebSockets properly
CMD ["chainlit", "run", "main.py", "--host", "0.0.0.0", "--port", "8080", "--headless"]