dockerchatbot / Dockerfile
Maahin757's picture
Update Dockerfile
f074111 verified
Raw History Blame Contribute Delete
1 kB
# Use an official Python runtime as a parent image
FROM python:3.13-slim
# Switch to root temporarily to install system-level packages
USER root
# Install compiler tools needed to build older wheels from source
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Set up a new user with UID 1000 (Hugging Face standard)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory inside the container
WORKDIR $HOME/app
# Copy requirements and install dependencies
COPY --chown=user requirements.txt $HOME/app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Create a local data folder for SQLite that the container user can write to
RUN mkdir -p $HOME/app/data
# Copy the rest of the application files
COPY --chown=user . $HOME/app
# Expose port 7860 for Hugging Face
EXPOSE 7860
# Run the application
CMD ["python", "app.py"]