Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +38 -0
Dockerfile
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.10
|
2 |
+
|
3 |
+
WORKDIR /code
|
4 |
+
|
5 |
+
COPY ./requirements.txt /code/requirements.txt
|
6 |
+
COPY ./pre-requirements.txt /code/pre-requirements.txt
|
7 |
+
|
8 |
+
RUN pip install --no-cache-dir --upgrade -r /code/pre-requirements.txt
|
9 |
+
RUN pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu117
|
10 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
11 |
+
|
12 |
+
# Set up a new user named "user" with user ID 1000
|
13 |
+
RUN useradd -m -u 1000 user
|
14 |
+
# Switch to the "user" user
|
15 |
+
USER user
|
16 |
+
|
17 |
+
# Set home to the user's home directory
|
18 |
+
ENV HOME=/home/user \
|
19 |
+
PATH=/home/user/.local/bin:$PATH \
|
20 |
+
PYTHONPATH=$HOME/app \
|
21 |
+
PYTHONUNBUFFERED=1 \
|
22 |
+
GRADIO_ALLOW_FLAGGING=never \
|
23 |
+
GRADIO_NUM_PORTS=1 \
|
24 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
25 |
+
GRADIO_THEME=huggingface \
|
26 |
+
SYSTEM=spaces
|
27 |
+
|
28 |
+
|
29 |
+
# Set the working directory to the user's home directory
|
30 |
+
WORKDIR $HOME/app
|
31 |
+
|
32 |
+
# download falcon-40b
|
33 |
+
RUN python -c 'from huggingface_hub import snapshot_download; snapshot_download("tiiuae/falcon-40b")'
|
34 |
+
|
35 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
36 |
+
COPY --chown=user . $HOME/app
|
37 |
+
|
38 |
+
CMD ["python", "app.py"]
|