File size: 813 Bytes
ff4f2e5 9ed117a ff4f2e5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Use a Python base image
FROM python:3.11-slim
# Set the working directory
WORKDIR /code
# Install git to clone the repo
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Clone the repository into the current directory
RUN git clone https://github.com/koo1140/OpenAgent .
# Install dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Create a user to avoid running as root (HF requirement/best practice)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Override the port using an Environment Variable or Command Line Argument
# Since the script has hardcoded port=8000, we run it via the uvicorn CLI
# to bypass the main.py hardcoding.
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|