Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +15 -8
Dockerfile
CHANGED
@@ -4,9 +4,18 @@ FROM python:3.9
|
|
4 |
RUN useradd -m -u 1000 user
|
5 |
|
6 |
# Set the working directory and user environment variables
|
7 |
-
ENV HOME=/
|
8 |
PATH=/bin:$PATH
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
# Copy the requirements file to the /code directory
|
11 |
COPY ./requirements.txt /code/requirements.txt
|
12 |
|
@@ -14,24 +23,22 @@ COPY ./requirements.txt /code/requirements.txt
|
|
14 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
15 |
|
16 |
# Create a directory for cache and set permissions
|
17 |
-
RUN mkdir -p /.cache && chmod 777 /.cache && chown user:user /.cache
|
18 |
-
|
19 |
-
RUN pwd && ls -l
|
20 |
|
21 |
# Create the database file and set permissions
|
22 |
-
RUN touch /app/users.db && chmod 777 /app/users.db && chown user:user /app/users.db
|
23 |
|
24 |
# Change ownership of mentor.txt and temp_mentor.txt
|
25 |
-
RUN chown user:user /app/mentor.txt /app/temp_mentor.txt
|
26 |
|
27 |
# Change ownership of the 'app' directory
|
28 |
-
RUN chown user:user /app
|
29 |
|
30 |
# Switch back to the user
|
31 |
USER user
|
32 |
|
33 |
# Set the working directory for the application
|
34 |
-
WORKDIR /app
|
35 |
|
36 |
# Start the application using gunicorn
|
37 |
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "--timeout", "300", "main:app"]
|
|
|
4 |
RUN useradd -m -u 1000 user
|
5 |
|
6 |
# Set the working directory and user environment variables
|
7 |
+
ENV HOME=/ /app
|
8 |
PATH=/bin:$PATH
|
9 |
|
10 |
+
# Switch to the user's home directory
|
11 |
+
WORKDIR $HOME
|
12 |
+
|
13 |
+
# Create a new directory named 'app'
|
14 |
+
RUN mkdir -p $HOME/app
|
15 |
+
|
16 |
+
# Copy the application files into the 'app' directory
|
17 |
+
COPY --chown=user:user . $HOME/app
|
18 |
+
|
19 |
# Copy the requirements file to the /code directory
|
20 |
COPY ./requirements.txt /code/requirements.txt
|
21 |
|
|
|
23 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
24 |
|
25 |
# Create a directory for cache and set permissions
|
26 |
+
RUN mkdir -p $HOME/.cache && chmod 777 $HOME/.cache && chown user:user $HOME/.cache
|
|
|
|
|
27 |
|
28 |
# Create the database file and set permissions
|
29 |
+
RUN touch $HOME/app/users.db && chmod 777 $HOME/app/users.db && chown user:user $HOME/app/users.db
|
30 |
|
31 |
# Change ownership of mentor.txt and temp_mentor.txt
|
32 |
+
RUN chown user:user $HOME/app/mentor.txt $HOME/app/temp_mentor.txt
|
33 |
|
34 |
# Change ownership of the 'app' directory
|
35 |
+
RUN chown user:user $HOME/app
|
36 |
|
37 |
# Switch back to the user
|
38 |
USER user
|
39 |
|
40 |
# Set the working directory for the application
|
41 |
+
WORKDIR $HOME/app
|
42 |
|
43 |
# Start the application using gunicorn
|
44 |
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "--timeout", "300", "main:app"]
|