Spaces:
No application file
No application file
Update dockerfile
Browse files- dockerfile +17 -12
dockerfile
CHANGED
|
@@ -1,23 +1,28 @@
|
|
| 1 |
# Base image
|
| 2 |
-
FROM python:3.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Set the working directory inside the container
|
| 5 |
-
WORKDIR /
|
| 6 |
|
| 7 |
-
# Copy necessary files into the container
|
| 8 |
-
COPY requirements.txt requirements.txt
|
| 9 |
-
COPY app.py app.py
|
| 10 |
-
COPY model model
|
| 11 |
-
COPY Dataset Dataset
|
| 12 |
-
COPY templates templates
|
| 13 |
-
COPY static static
|
| 14 |
-
COPY Utility Utility
|
| 15 |
|
| 16 |
# Install dependencies
|
| 17 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 18 |
|
| 19 |
# Expose the required port
|
| 20 |
EXPOSE 5000
|
| 21 |
|
| 22 |
# Set the default command to run the Flask app
|
| 23 |
-
CMD ["python", "app.py"
|
|
|
|
| 1 |
# Base image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Create and switch to a non-root user
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
USER user
|
| 7 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 8 |
|
| 9 |
# Set the working directory inside the container
|
| 10 |
+
WORKDIR /app
|
| 11 |
|
| 12 |
+
# Copy necessary files into the container with ownership set to the user
|
| 13 |
+
COPY --chown=user requirements.txt requirements.txt
|
| 14 |
+
COPY --chown=user app.py app.py
|
| 15 |
+
COPY --chown=user model model
|
| 16 |
+
COPY --chown=user Dataset Dataset
|
| 17 |
+
COPY --chown=user templates templates
|
| 18 |
+
COPY --chown=user static static
|
| 19 |
+
COPY --chown=user Utility Utility
|
| 20 |
|
| 21 |
# Install dependencies
|
| 22 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 23 |
|
| 24 |
# Expose the required port
|
| 25 |
EXPOSE 5000
|
| 26 |
|
| 27 |
# Set the default command to run the Flask app
|
| 28 |
+
CMD ["python", "app.py"]
|