Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +22 -6
Dockerfile
CHANGED
|
@@ -1,14 +1,30 @@
|
|
| 1 |
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
| 2 |
# you will also find guides on how best to write your Dockerfile
|
| 3 |
-
|
| 4 |
FROM python:3.11
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
COPY
|
| 9 |
|
| 10 |
-
RUN pip install --no-cache-dir --upgrade -r
|
| 11 |
|
| 12 |
-
COPY . .
|
| 13 |
|
| 14 |
-
|
|
|
|
| 1 |
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
| 2 |
# you will also find guides on how best to write your Dockerfile
|
|
|
|
| 3 |
FROM python:3.11
|
| 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 |
+
# Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
|
| 19 |
+
RUN pip install --no-cache-dir --upgrade pip
|
| 20 |
+
|
| 21 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 22 |
+
COPY --chown=user . $HOME/app
|
| 23 |
|
| 24 |
+
COPY --chown=user requirements.txt .
|
| 25 |
|
| 26 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 27 |
|
| 28 |
+
COPY --chown=user app.py app.py
|
| 29 |
|
| 30 |
+
ENTRYPOINT ["solara", "run", "sol.py", "--host=0.0.0.0", "--port", "7860"]
|