Spaces:
Sleeping
Sleeping
Download blenderbot_model via Docker
Browse files- Dockerfile +26 -24
Dockerfile
CHANGED
@@ -1,24 +1,26 @@
|
|
1 |
-
FROM python:3.9
|
2 |
-
|
3 |
-
# Set the working directory
|
4 |
-
WORKDIR /code
|
5 |
-
|
6 |
-
# Copy the requirements file and install dependencies
|
7 |
-
COPY ./requirements.txt /code/requirements.txt
|
8 |
-
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
9 |
-
|
10 |
-
# Create a user and set environment variables
|
11 |
-
RUN useradd user
|
12 |
-
USER user
|
13 |
-
ENV HOME=/home/user \
|
14 |
-
PATH=/home/user/.local/bin:$PATH
|
15 |
-
|
16 |
-
# Set the working directory for the user
|
17 |
-
WORKDIR $HOME/app
|
18 |
-
|
19 |
-
# Copy the application code and the model folder
|
20 |
-
COPY --chown=user . $HOME/app
|
21 |
-
COPY --chown=user ./en_core_web_sm-3.8.0 $HOME/app/en_core_web_sm-3.8.0
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
# Set the working directory
|
4 |
+
WORKDIR /code
|
5 |
+
|
6 |
+
# Copy the requirements file and install dependencies
|
7 |
+
COPY ./requirements.txt /code/requirements.txt
|
8 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
9 |
+
|
10 |
+
# Create a user and set environment variables
|
11 |
+
RUN useradd user
|
12 |
+
USER user
|
13 |
+
ENV HOME=/home/user \
|
14 |
+
PATH=/home/user/.local/bin:$PATH
|
15 |
+
|
16 |
+
# Set the working directory for the user
|
17 |
+
WORKDIR $HOME/app
|
18 |
+
|
19 |
+
# Copy the application code and the model folder
|
20 |
+
COPY --chown=user . $HOME/app
|
21 |
+
COPY --chown=user ./en_core_web_sm-3.8.0 $HOME/app/en_core_web_sm-3.8.0
|
22 |
+
COPY --chown=user ./download_model.py $HOME/app/download_model.py
|
23 |
+
RUN python download_model.py # Downloads during build
|
24 |
+
|
25 |
+
# Set the command to run the application
|
26 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|