Spaces:
Sleeping
Sleeping
File size: 1,274 Bytes
4c80166 d11625e 4c80166 | 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 27 28 29 30 31 32 33 34 35 36 37 38 | # =============================================================================
# Author: Rick Escher
# Project: SailingMedAdvisor
# Context: Google HAI-DEF Framework
# Models: Google MedGemmas
# Program: Kaggle Impact Challenge
# =============================================================================
FROM python:3.10-slim
# 1. Install system tools as ROOT
# Include wget + git because Hugging Face's injected dev-init step uses both.
RUN apt-get update && apt-get install -y build-essential curl wget git && rm -rf /var/lib/apt/lists/*
# 2. Setup the user but STAY as root for a moment
RUN useradd -m -u 1000 user
WORKDIR /home/user/app
# 3. Create the folder while still ROOT
RUN mkdir -p /home/user/app/data \
/home/user/app/uploads/medicines \
/home/user/app/offload \
/home/user/app/models_cache \
/home/user/app/backups && \
chown -R user:user /home/user/app
# 4. NOW switch to the user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# 5. Copy files and install (using --chown for safety)
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt
COPY --chown=user . .
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|