Spaces:
Sleeping
Sleeping
vancyferns
commited on
Commit
·
b0a5f82
1
Parent(s):
beec292
updated dockerfile
Browse files- Dockerfile +9 -8
Dockerfile
CHANGED
|
@@ -14,23 +14,24 @@ RUN apt-get update && apt-get install -y \
|
|
| 14 |
# Set the working directory inside the container
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
-
#
|
| 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 |
-
|
| 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 |
-
|
| 33 |
-
COPY --chown=appuser:appuser model .
|
| 34 |
|
| 35 |
# Expose the port where the Flask API will run
|
| 36 |
EXPOSE 7860
|
|
|
|
| 14 |
# Set the working directory inside the container
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
+
# Create a non-root user and give them ownership of the working directory
|
|
|
|
|
|
|
|
|
|
| 18 |
RUN useradd -m -s /bin/bash appuser
|
| 19 |
+
RUN chown -R appuser:appuser /app
|
| 20 |
+
|
| 21 |
+
# Switch to the new user for all subsequent commands
|
| 22 |
USER appuser
|
| 23 |
|
| 24 |
+
# Set the DEEPFACE_HOME environment variable to a writable directory
|
| 25 |
+
ENV DEEPFACE_HOME=/app
|
| 26 |
+
|
| 27 |
# Copy the requirements file from the 'model' directory
|
| 28 |
+
COPY model/requirements.txt .
|
|
|
|
| 29 |
|
| 30 |
# Install Python dependencies
|
| 31 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 32 |
|
| 33 |
# Copy the rest of the 'model' directory's contents
|
| 34 |
+
COPY model .
|
|
|
|
| 35 |
|
| 36 |
# Expose the port where the Flask API will run
|
| 37 |
EXPOSE 7860
|