HealsmindAIPetals / Dockerfile
lavanjv's picture
Update Dockerfile
46d6dc6
# Use the official Python image as the base image
FROM python:3.10
# Set the working directory in the container
WORKDIR /app
# Create a non-root user
RUN useradd -ms /bin/bash myuser
# Give the user ownership of the working directory and home directory
RUN chown -R myuser:myuser /app /home/myuser
# Switch to the non-root user
USER myuser
# Copy the entire contents of the local directory into the container
COPY . .
# Expose the secret HUGGINGFACE_TOKEN at buildtime and use its value as the Hugging Face token
RUN --mount=type=secret,id=HUGGINGFACE_TOKEN,mode=0444,required=true \
echo "HUGGINGFACE_TOKEN=$(cat /run/secrets/HUGGINGFACE_TOKEN)" > .env
# Install chainlit and add it to PATH
RUN pip install chainlit --user
# Set the PATH to include user-specific binaries
ENV PATH="/home/myuser/.local/bin:${PATH}"
# Install the required Python packages
RUN pip install -r requirements.txt
# Expose port 7860 internally in the container
EXPOSE 7860
# Run the ChainLit command
CMD ["chainlit", "run", "model.py", "-w", "--port", "7860"]