Spaces:
Runtime error
Runtime error
Benjamin Bossan
commited on
Commit
·
7ffc395
1
Parent(s):
374837f
Try fixing TRANSFORMER_CACHE issue #2
Browse filesTry this suggestion:
https://huggingface.co/docs/hub/spaces-sdks-docker#permissionshttps://huggingface.co/docs/hub/spaces-sdks-docker#permissions
- Dockerfile +18 -9
Dockerfile
CHANGED
|
@@ -2,20 +2,29 @@ FROM pytorch/pytorch:latest
|
|
| 2 |
|
| 3 |
RUN apt update && apt install -y && rm -rf /var/lib/apt/lists/*
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
RUN python3 -m pip install -r requirements.txt
|
| 7 |
|
| 8 |
-
COPY setup.py VERSION .
|
| 9 |
-
COPY src ./src
|
| 10 |
RUN python3 -m pip install .
|
| 11 |
|
| 12 |
-
COPY "demo.py" .
|
| 13 |
EXPOSE 7860 8080
|
| 14 |
-
COPY start.sh .
|
| 15 |
RUN chmod +x start.sh
|
| 16 |
|
| 17 |
-
RUN chmod 777 /workspace
|
| 18 |
-
RUN mkdir -p /workspace/.cache/huggingface/hub
|
| 19 |
-
ENV TRANSFORMERS_CACHE=/workspace/.cache/huggingface/hub
|
| 20 |
-
|
| 21 |
CMD ["./start.sh"]
|
|
|
|
| 2 |
|
| 3 |
RUN apt update && apt install -y && rm -rf /var/lib/apt/lists/*
|
| 4 |
|
| 5 |
+
# Set up a new user named "user" with user ID 1000
|
| 6 |
+
RUN useradd -m -u 1000 user
|
| 7 |
+
|
| 8 |
+
# Switch to the "user" user
|
| 9 |
+
USER user
|
| 10 |
+
|
| 11 |
+
# Set home to the user's home directory
|
| 12 |
+
ENV HOME=/home/user \
|
| 13 |
+
PATH=/home/user/.local/bin:$PATH
|
| 14 |
+
|
| 15 |
+
# Set the working directory to the user's home directory
|
| 16 |
+
WORKDIR $HOME/app
|
| 17 |
+
|
| 18 |
+
COPY --chown=user requirements.txt .
|
| 19 |
RUN python3 -m pip install -r requirements.txt
|
| 20 |
|
| 21 |
+
COPY --chown=user setup.py VERSION .
|
| 22 |
+
COPY --chown=user src ./src
|
| 23 |
RUN python3 -m pip install .
|
| 24 |
|
| 25 |
+
COPY --chown=user "demo.py" .
|
| 26 |
EXPOSE 7860 8080
|
| 27 |
+
COPY --chown=user start.sh .
|
| 28 |
RUN chmod +x start.sh
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
CMD ["./start.sh"]
|