Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +11 -19
Dockerfile
CHANGED
@@ -1,35 +1,27 @@
|
|
|
|
1 |
FROM python:3.9
|
2 |
|
3 |
-
# Set
|
4 |
WORKDIR /code
|
5 |
|
|
|
6 |
COPY ./requirements.txt /code/requirements.txt
|
7 |
|
|
|
8 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
9 |
|
10 |
-
#
|
11 |
RUN useradd -m -u 1000 user
|
12 |
-
|
13 |
USER user
|
14 |
-
|
15 |
ENV HOME=/home/user \
|
16 |
-
PATH=/home/user/.local/bin:$PATH
|
17 |
-
HF_HOME=/home/user/.cache/huggingface \
|
18 |
-
OPENAI_API_KEY=your_openai_api_key_here
|
19 |
|
|
|
20 |
WORKDIR $HOME/app
|
21 |
|
22 |
-
# Copy the
|
23 |
COPY --chown=user . $HOME/app
|
24 |
|
25 |
-
|
26 |
-
RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME
|
27 |
-
|
28 |
-
# Expose the port the app runs on
|
29 |
-
EXPOSE 8000
|
30 |
-
|
31 |
-
# Install hypercorn
|
32 |
-
RUN pip install hypercorn
|
33 |
-
|
34 |
-
# Run the application using hypercorn
|
35 |
-
CMD ["hypercorn", "main:app", "--bind", "0.0.0.0:8000"]
|
|
|
1 |
+
# Use the official Python 3.9 image
|
2 |
FROM python:3.9
|
3 |
|
4 |
+
# Set the working directory to /code
|
5 |
WORKDIR /code
|
6 |
|
7 |
+
# Copy the current directory contents into the container at /code
|
8 |
COPY ./requirements.txt /code/requirements.txt
|
9 |
|
10 |
+
# Install requirements.txt
|
11 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
12 |
|
13 |
+
# Set up a new user named "user" with user ID 1000
|
14 |
RUN useradd -m -u 1000 user
|
15 |
+
# Switch to the "user" user
|
16 |
USER user
|
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 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|