Spaces:
Runtime error
Runtime error
Commit
·
5845b9e
1
Parent(s):
0964b21
Uploaded default dockerfile
Browse files- Dockerfile +34 -0
Dockerfile
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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.9
|
| 5 |
+
|
| 6 |
+
WORKDIR /code
|
| 7 |
+
|
| 8 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 9 |
+
|
| 10 |
+
RUN pip install --no-cache-dir --upgrade pip
|
| 11 |
+
|
| 12 |
+
RUN --mount=type=secret,id=PIPLOC,mode=0444,required=true \
|
| 13 |
+
PIPLOC=$(cat /run/secrets/PIPLOC) \
|
| 14 |
+
pip install --no-cache-dir ${PIPLOC}
|
| 15 |
+
|
| 16 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 17 |
+
|
| 18 |
+
# Set up a new user named "user" with user ID 1000
|
| 19 |
+
RUN useradd -m -u 1000 user
|
| 20 |
+
|
| 21 |
+
# Switch to the "user" user
|
| 22 |
+
USER user
|
| 23 |
+
|
| 24 |
+
# Set home to the user's home directory
|
| 25 |
+
ENV HOME=/home/user \
|
| 26 |
+
PATH=/home/user/.local/bin:$PATH
|
| 27 |
+
|
| 28 |
+
# Set the working directory to the user's home directory
|
| 29 |
+
WORKDIR $HOME/app
|
| 30 |
+
|
| 31 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 32 |
+
COPY --chown=user . $HOME/app
|
| 33 |
+
|
| 34 |
+
CMD ["python", "app.py"]
|