Spaces:
Sleeping
Sleeping
EL GHAFRAOUI AYOUB
commited on
Commit
·
8b0f095
1
Parent(s):
75d4ea8
- Dockerfile +18 -15
Dockerfile
CHANGED
@@ -1,27 +1,30 @@
|
|
1 |
# Use Python 3.11 slim image
|
2 |
FROM python:3.11-slim
|
3 |
|
4 |
-
# Set
|
5 |
-
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
|
10 |
-
#
|
11 |
-
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
#
|
14 |
-
|
15 |
|
16 |
-
#
|
17 |
-
RUN
|
18 |
-
chown -R myuser:myuser /app/data
|
19 |
|
20 |
-
#
|
21 |
-
|
22 |
|
23 |
-
#
|
24 |
-
|
25 |
|
26 |
# Expose port
|
27 |
EXPOSE 8000
|
|
|
1 |
# Use Python 3.11 slim image
|
2 |
FROM python:3.11-slim
|
3 |
|
4 |
+
# Set up a new user named "user" with user ID 1000
|
5 |
+
RUN useradd -m -u 1000 user
|
6 |
|
7 |
+
# Switch to the "user" user
|
8 |
+
USER user
|
9 |
|
10 |
+
# Set home to the user's home directory
|
11 |
+
ENV HOME=/home/user \
|
12 |
+
PATH=/home/user/.local/bin:$PATH
|
13 |
+
|
14 |
+
# Set the working directory to the user's home directory
|
15 |
+
WORKDIR $HOME/app
|
16 |
|
17 |
+
# Copy requirements with correct ownership
|
18 |
+
COPY --chown=user requirements.txt .
|
19 |
|
20 |
+
# Install dependencies
|
21 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
22 |
|
23 |
+
# Copy the application code with correct ownership
|
24 |
+
COPY --chown=user . .
|
25 |
|
26 |
+
# Create data directory in the persistent storage location
|
27 |
+
RUN mkdir -p /data
|
28 |
|
29 |
# Expose port
|
30 |
EXPOSE 8000
|