Spaces:
Sleeping
Sleeping
vancyferns commited on
Commit ·
beec292
1
Parent(s): 9d1dd35
updated dockerfile
Browse files- Dockerfile +8 -2
Dockerfile
CHANGED
|
@@ -17,14 +17,20 @@ WORKDIR /app
|
|
| 17 |
# Set the DEEPFACE_HOME environment variable to a writable directory
|
| 18 |
ENV DEEPFACE_HOME=/app
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# Copy the requirements file from the 'model' directory
|
| 21 |
-
|
|
|
|
| 22 |
|
| 23 |
# Install Python dependencies
|
| 24 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 25 |
|
| 26 |
# Copy the rest of the 'model' directory's contents
|
| 27 |
-
|
|
|
|
| 28 |
|
| 29 |
# Expose the port where the Flask API will run
|
| 30 |
EXPOSE 7860
|
|
|
|
| 17 |
# Set the DEEPFACE_HOME environment variable to a writable directory
|
| 18 |
ENV DEEPFACE_HOME=/app
|
| 19 |
|
| 20 |
+
# Create a non-root user and switch to it for security and permissions
|
| 21 |
+
RUN useradd -m -s /bin/bash appuser
|
| 22 |
+
USER appuser
|
| 23 |
+
|
| 24 |
# Copy the requirements file from the 'model' directory
|
| 25 |
+
# Use --chown to set the owner to the new user
|
| 26 |
+
COPY --chown=appuser:appuser model/requirements.txt .
|
| 27 |
|
| 28 |
# Install Python dependencies
|
| 29 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 30 |
|
| 31 |
# Copy the rest of the 'model' directory's contents
|
| 32 |
+
# Use --chown to set the owner to the new user
|
| 33 |
+
COPY --chown=appuser:appuser model .
|
| 34 |
|
| 35 |
# Expose the port where the Flask API will run
|
| 36 |
EXPOSE 7860
|