Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +15 -5
Dockerfile
CHANGED
|
@@ -1,18 +1,28 @@
|
|
| 1 |
# Base image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# Set
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
RUN apt-get update && apt-get install -y build-essential
|
| 8 |
|
| 9 |
# Install dependencies
|
| 10 |
-
COPY requirements.txt .
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
# Copy app code
|
| 14 |
-
COPY app ./app
|
| 15 |
-
COPY models ./app/models
|
| 16 |
|
| 17 |
# Expose port
|
| 18 |
EXPOSE 7860
|
|
|
|
| 1 |
# Base 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 to the user's home directory
|
| 15 |
+
WORKDIR $HOME/app
|
| 16 |
|
| 17 |
RUN apt-get update && apt-get install -y build-essential
|
| 18 |
|
| 19 |
# Install dependencies
|
| 20 |
+
COPY --chown=user requirements.txt .
|
| 21 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 22 |
|
| 23 |
# Copy app code
|
| 24 |
+
COPY --chown=user app ./app
|
| 25 |
+
COPY --chown=user models ./app/models
|
| 26 |
|
| 27 |
# Expose port
|
| 28 |
EXPOSE 7860
|