Spaces:
Sleeping
Sleeping
Commit
·
624a711
1
Parent(s):
75e4552
modified docker file to create user and set ENV path to HOME, ensure dockerfile points to expected port 7860
Browse files- Dockerfile +13 -3
Dockerfile
CHANGED
|
@@ -1,11 +1,21 @@
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
# Set the working directory in the container
|
| 5 |
-
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Copy the current directory contents into the container at /app
|
| 8 |
-
COPY . /app
|
| 9 |
|
| 10 |
# Install any necessary dependencies specified in requirements.txt
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 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 in the container
|
| 15 |
+
WORKDIR $HOME/app
|
| 16 |
|
| 17 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 18 |
+
COPY --chown=user . $HOME/app
|
| 19 |
|
| 20 |
# Install any necessary dependencies specified in requirements.txt
|
| 21 |
RUN pip install --no-cache-dir -r requirements.txt
|