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