Spaces:
Sleeping
Sleeping
add user permissions to Dockerfile
Browse files- Dockerfile +16 -3
Dockerfile
CHANGED
@@ -1,14 +1,27 @@
|
|
1 |
# Dockerfile
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# Install dependencies
|
7 |
COPY requirements.txt .
|
8 |
RUN pip install --no-cache-dir -r requirements.txt
|
9 |
|
10 |
-
# Copy the app files
|
11 |
-
|
|
|
12 |
|
13 |
# Expose the port FastAPI will run on
|
14 |
EXPOSE 7860
|
|
|
1 |
# Dockerfile
|
2 |
FROM python:3.10-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 |
|
18 |
# Install dependencies
|
19 |
COPY requirements.txt .
|
20 |
RUN pip install --no-cache-dir -r requirements.txt
|
21 |
|
22 |
+
# Copy the app files # COPY . .
|
23 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
24 |
+
COPY --chown=user . $HOME/app
|
25 |
|
26 |
# Expose the port FastAPI will run on
|
27 |
EXPOSE 7860
|