DreamFlow-AI / Dockerfile
Sachin21112004's picture
updated
e4a66c6 verified
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /code
# Copy the requirements file into the container
COPY ./requirements.txt /code/requirements.txt
# Install all the Python libraries your bot needs
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Create necessary directories with proper permissions
RUN mkdir -p /code/logs /code/huggingface_cache /code/db \
&& chmod -R 755 /code/logs /code/huggingface_cache /code/db
# Use HF_HOME instead of TRANSFORMERS_CACHE (future-proof)
ENV HF_HOME=/code/huggingface_cache
# Copy all your project files into the container
COPY . /code/
# Switch to a non-root user for security (optional but recommended)
RUN useradd -m -r -u 1000 appuser \
&& chown -R appuser:appuser /code
USER appuser
# Expose the port Hugging Face Spaces expects
EXPOSE 7860
# Run the FastAPI app with Uvicorn
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]