baseball-predictor / Dockerfile
hengds2f's picture
Update Dockerfile
ddd4c9a verified
Raw History Blame Contribute Delete
664 Bytes
FROM python:3.10
# 1. Create a standard, non-root user (Hugging Face requires this for security)
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# 2. Set the working directory to the new user's home folder
WORKDIR /home/user/app
# THE FIX: Force the threads to be a valid integer
ENV OMP_NUM_THREADS="2"
# 3. Copy requirements and give ownership to the new user
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# 4. Copy the rest of your code and model
COPY --chown=user . .
# 5. Start the server
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]