adfras's picture
Grant user with right write permissions to entire project directory
885663b
raw
history blame contribute delete
617 Bytes
FROM python:3.11-slim
# system packages
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# create the non-root Space user (UID 1000)
RUN useradd -m -u 1000 user
# copy project before dropping privileges
WORKDIR /home/user/app
COPY --chown=user . .
# install Python requirements as root
RUN pip install --no-cache-dir -r requirements.txt
# persistent storage and HF caches
RUN mkdir -p /data && chown 1000:1000 /data
ENV HF_HOME=/home/user/.cache/huggingface \
TRANSFORMERS_CACHE=/data/.cache
# switch to un-privileged user
USER 1000
CMD ["python", "finetune_distractor_model.py"]