Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +27 -36
Dockerfile
CHANGED
@@ -1,48 +1,39 @@
|
|
1 |
-
|
2 |
-
FROM python:3.10
|
3 |
|
4 |
-
#
|
|
|
|
|
|
|
|
|
5 |
WORKDIR /code
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
libopenblas-dev \
|
18 |
-
libatlas-base-dev \
|
19 |
-
liblapack-dev \
|
20 |
-
build-essential \
|
21 |
-
&& apt-get clean \
|
22 |
-
&& rm -rf /var/lib/apt/lists/*
|
23 |
-
|
24 |
-
# Copy the requirements file into the container
|
25 |
-
COPY requirements.txt /code/requirements.txt
|
26 |
-
|
27 |
-
# Upgrade pip and install dependencies
|
28 |
-
RUN pip install --upgrade pip \
|
29 |
-
&& pip install --no-cache-dir -r /code/requirements.txt
|
30 |
-
|
31 |
-
# Add a user with a home directory
|
32 |
-
RUN useradd -m -u 1000 user
|
33 |
-
|
34 |
-
# Switch to the new user
|
35 |
USER user
|
36 |
|
37 |
-
#
|
|
|
38 |
ENV HOME=/home/user \
|
39 |
-
|
40 |
|
41 |
# Set the working directory to the user's home directory
|
42 |
WORKDIR $HOME/app
|
43 |
|
44 |
-
# Copy the
|
45 |
COPY --chown=user . $HOME/app
|
46 |
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
## Use the official Python 3.9 image
|
2 |
+
FROM python:3.10
|
3 |
|
4 |
+
# ENV http_proxy="http://130.162.148.105:8080"
|
5 |
+
# ENV https_proxy="http://72.10.164.178:1417"
|
6 |
+
# ENV no_proxy="localhost,127.0.0.1"
|
7 |
+
|
8 |
+
## set the working directory to /code
|
9 |
WORKDIR /code
|
10 |
|
11 |
+
## Copy the current directory contents in the container at /code
|
12 |
+
COPY ./requirements.txt /code/requirements.txt
|
13 |
+
|
14 |
+
## Install the requirements.txt
|
15 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
16 |
+
RUN pip install --no-cache-dir --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
|
17 |
+
|
18 |
+
# Set up a new user named "user"
|
19 |
+
RUN useradd user
|
20 |
+
# Switch to the "user" user
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
USER user
|
22 |
|
23 |
+
# Set home to the user's home directory
|
24 |
+
|
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 |
+
|
35 |
+
# Verify files copied correctly by listing them
|
36 |
+
RUN ls -la $HOME/app
|
37 |
+
|
38 |
+
## Start the FASTAPI App on port 7860
|
39 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|