Spaces:
Sleeping
Sleeping
h3110Fr13nd
commited on
Commit
•
c88dc9f
1
Parent(s):
2b9aa32
Update Dockerfile
Browse files- Dockerfile +12 -4
Dockerfile
CHANGED
@@ -1,18 +1,26 @@
|
|
1 |
# Use the official Python image as the base image
|
2 |
FROM python:3.9-slim
|
3 |
|
|
|
4 |
|
|
|
|
|
|
|
|
|
5 |
# Set the working directory in the container
|
6 |
-
WORKDIR /app
|
|
|
|
|
|
|
7 |
# Copy the requirements file into the container
|
8 |
-
COPY requirements.txt .
|
9 |
|
10 |
# Install the requirements
|
11 |
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
|
13 |
# Copy the rest of the application code into the container
|
14 |
-
COPY .
|
15 |
-
|
16 |
# Expose port 8080 for the Flask app
|
17 |
EXPOSE 8080
|
18 |
# Set the entrypoint command to run the Flask app
|
|
|
1 |
# Use the official Python image as the base image
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
+
RUN useradd -m -u 1000 user
|
5 |
|
6 |
+
# Switch to the "user" user
|
7 |
+
USER user
|
8 |
+
ENV HOME=/home/user \
|
9 |
+
PATH=/home/user/.local/bin:$PATH
|
10 |
# Set the working directory in the container
|
11 |
+
WORKDIR $HOME/app
|
12 |
+
|
13 |
+
RUN pip install --no-cache-dir --upgrade pip
|
14 |
+
|
15 |
# Copy the requirements file into the container
|
16 |
+
COPY --chown=user requirements.txt .
|
17 |
|
18 |
# Install the requirements
|
19 |
RUN pip install --no-cache-dir -r requirements.txt
|
20 |
|
21 |
# Copy the rest of the application code into the container
|
22 |
+
COPY --chown=user . $HOME/app
|
23 |
+
RUN chmod 777 $HOME/app
|
24 |
# Expose port 8080 for the Flask app
|
25 |
EXPOSE 8080
|
26 |
# Set the entrypoint command to run the Flask app
|