ChatAI / Dockerfile
Co2fi-crs's picture
ReUpload files after messing up things
755e71e verified
FROM python:3.10-slim
# Hugging Face runs on UID 1000
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /home/user/app
# Install dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy app files
COPY --chown=user . .
# IMPORTANT: Use --server.address and --server.port
# Do NOT use --host or -p
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
# # Use a lightweight Python base image
# FROM python:3.10-slim
# # Set the working directory inside the container
# # Streamlit apps work best when not run from the root '/' directory
# WORKDIR /app
# # Install system dependencies (optional but recommended for image processing)
# RUN apt-get update && apt-get install -y \
# build-essential \
# curl \
# software-properties-common \
# && rm -rf /var/lib/apt/lists/*
# # Copy requirements first to leverage Docker caching
# COPY requirements.txt .
# # Install Python dependencies
# RUN pip install --no-cache-dir -r requirements.txt
# # Copy the rest of your app files (app.py and the images folder)
# COPY . .
# # Expose the default Hugging Face port
# EXPOSE 7860
# # Command to run the Streamlit app
# # Note: --server.port 7860 and --server.address 0.0.0.0 are required for HF
# CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]