Spaces:
Sleeping
Sleeping
Commit
·
a749c69
1
Parent(s):
507cb85
Server Deployment
Browse files- Dockerfile +15 -4
Dockerfile
CHANGED
@@ -1,13 +1,24 @@
|
|
|
|
1 |
FROM python:3.9
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
WORKDIR /code
|
4 |
|
|
|
5 |
COPY ./requirements.txt /code/requirements.txt
|
6 |
-
|
7 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
|
9 |
-
|
|
|
10 |
|
11 |
-
|
|
|
12 |
|
13 |
-
|
|
|
|
1 |
+
# Use Python 3.9 as the base image
|
2 |
FROM python:3.9
|
3 |
|
4 |
+
# Create a new user with UID 1000 and a home directory
|
5 |
+
RUN useradd -m -u 1000 user
|
6 |
+
|
7 |
+
# Set the new user as the default user for the container
|
8 |
+
USER user
|
9 |
+
|
10 |
+
# Set the working directory to /code
|
11 |
WORKDIR /code
|
12 |
|
13 |
+
# Copy requirements.txt and install dependencies
|
14 |
COPY ./requirements.txt /code/requirements.txt
|
|
|
15 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
16 |
|
17 |
+
# Change ownership of the /code directory to the user
|
18 |
+
RUN chown -R user:user /code
|
19 |
|
20 |
+
# Copy the rest of the codebase and set the ownership to the new user
|
21 |
+
COPY --chown=user:user . /code
|
22 |
|
23 |
+
# Set the command to run when the container starts
|
24 |
+
CMD ["gunicorn", "-b", "0.0.0.0:7860", "main:app"]
|