|
FROM python:3.9 |
|
|
|
|
|
RUN useradd -m -u 1000 user |
|
|
|
|
|
RUN mkdir -p /home/user/.cache/huggingface && \ |
|
mkdir -p /home/user/.cache/torch && \ |
|
chown -R user:user /home/user/.cache |
|
|
|
|
|
ENV TRANSFORMERS_CACHE=/home/user/.cache/huggingface |
|
ENV TORCH_HOME=/home/user/.cache/torch |
|
ENV HF_HOME=/home/user/.cache/huggingface |
|
|
|
WORKDIR /code |
|
|
|
|
|
COPY ./requirements.txt /code/requirements.txt |
|
RUN pip install --no-cache-dir -r requirements.txt |
|
|
|
|
|
COPY ./app.py /code/app.py |
|
|
|
|
|
RUN chown -R user:user /code |
|
|
|
|
|
USER user |
|
|
|
|
|
EXPOSE 7860 |
|
CMD ["python", "app.py"] |