ThomasBlumet
commited on
Commit
·
d5b3e9f
1
Parent(s):
3b3d4d4
change requirements and Dockerfile
Browse files- Dockerfile +44 -21
- requirements.txt +2 -1
Dockerfile
CHANGED
@@ -1,28 +1,51 @@
|
|
1 |
-
# For more information, please refer to https://aka.ms/vscode-docker-python
|
2 |
-
FROM python:3.9
|
3 |
|
4 |
-
# Where we'll copy the code
|
5 |
-
WORKDIR /code
|
6 |
|
7 |
-
# Copy the current directory contents into the container at /code
|
8 |
-
COPY ./requirements.txt /code/requirements.txt
|
9 |
-
# Install pip requirements
|
10 |
-
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
11 |
|
12 |
-
# Creates a non-root user with an explicit UID
|
13 |
-
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
|
14 |
-
RUN useradd -m -u 1000 user
|
15 |
-
USER user
|
16 |
|
17 |
-
# Set home to the user's home directory
|
18 |
-
ENV HOME=/home/user \
|
19 |
-
|
20 |
|
21 |
-
# Set the working directory to the user's home directory
|
22 |
-
WORKDIR $HOME/app
|
23 |
|
24 |
-
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
25 |
-
COPY --chown=user . $HOME/app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
-
|
28 |
-
CMD ["app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
+
# # For more information, please refer to https://aka.ms/vscode-docker-python
|
2 |
+
# FROM python:3.9
|
3 |
|
4 |
+
# # Where we'll copy the code
|
5 |
+
# WORKDIR /code
|
6 |
|
7 |
+
# # Copy the current directory contents into the container at /code
|
8 |
+
# COPY ./requirements.txt /code/requirements.txt
|
9 |
+
# # Install pip requirements
|
10 |
+
# RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
11 |
|
12 |
+
# # Creates a non-root user with an explicit UID
|
13 |
+
# # For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
|
14 |
+
# RUN useradd -m -u 1000 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 |
|
21 |
+
# # Set the working directory to the user's home directory
|
22 |
+
# WORKDIR $HOME/app
|
23 |
|
24 |
+
# # Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
25 |
+
# COPY --chown=user . $HOME/app
|
26 |
+
|
27 |
+
# # During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
|
28 |
+
# CMD ["uvicorn","app:app", "--host", "0.0.0.0", "--port", "7860"]
|
29 |
+
|
30 |
+
|
31 |
+
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
32 |
+
# you will also find guides on how best to write your Dockerfile
|
33 |
+
|
34 |
+
FROM python:3.9
|
35 |
+
|
36 |
+
# The two following lines are requirements for the Dev Mode to be functional
|
37 |
+
# Learn more about the Dev Mode at https://huggingface.co/dev-mode-explorers
|
38 |
+
RUN useradd -m -u 1000 user
|
39 |
+
WORKDIR /app
|
40 |
+
|
41 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
42 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
43 |
+
|
44 |
+
COPY --chown=user . /app
|
45 |
+
|
46 |
+
USER user
|
47 |
+
|
48 |
+
ENV HOME=/home/user \
|
49 |
+
PATH=/home/user/.local/bin:$PATH
|
50 |
|
51 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
requirements.txt
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
transformers
|
2 |
torch
|
3 |
gradio
|
4 |
-
huggingface_hub
|
|
|
|
1 |
transformers
|
2 |
torch
|
3 |
gradio
|
4 |
+
huggingface_hub
|
5 |
+
uvicorn[standard]==0.17.*
|