Spaces:
Runtime error
Runtime error
srivatsavdamaraju
commited on
Commit
•
8161e41
1
Parent(s):
2d3586a
Update Dockerfile
Browse files- Dockerfile +18 -20
Dockerfile
CHANGED
@@ -1,35 +1,33 @@
|
|
1 |
-
# Use an official Python
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
-
#
|
|
|
|
|
|
|
|
|
5 |
RUN apt-get update && apt-get install -y \
|
|
|
|
|
|
|
6 |
libgl1-mesa-glx \
|
7 |
libglib2.0-0 \
|
8 |
-
libsm6 \
|
9 |
-
libxext6 \
|
10 |
-
libxrender1 \
|
11 |
&& rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
-
# Set the working directory
|
14 |
WORKDIR /app
|
15 |
|
16 |
-
#
|
17 |
-
|
18 |
-
|
19 |
-
# Set environment variable to use the new cache location
|
20 |
-
ENV TORCH_HOME=/app/.cache/torch
|
21 |
-
|
22 |
-
# Copy the current directory contents into the container at /app
|
23 |
-
COPY . /app
|
24 |
|
25 |
-
#
|
26 |
RUN pip install --no-cache-dir -r requirements.txt
|
27 |
|
28 |
-
#
|
29 |
-
|
30 |
|
31 |
-
# Expose the port the app
|
32 |
EXPOSE 5000
|
33 |
|
34 |
-
#
|
35 |
-
CMD ["
|
|
|
1 |
+
# Step 1: Use an official Python base image
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
+
# Step 2: Set environment variables to prevent Python from writing .pyc files and to ensure the app runs in the background
|
5 |
+
ENV PYTHONDONTWRITEBYTECODE 1
|
6 |
+
ENV PYTHONUNBUFFERED 1
|
7 |
+
|
8 |
+
# Step 3: Install system dependencies
|
9 |
RUN apt-get update && apt-get install -y \
|
10 |
+
gcc \
|
11 |
+
g++ \
|
12 |
+
make \
|
13 |
libgl1-mesa-glx \
|
14 |
libglib2.0-0 \
|
|
|
|
|
|
|
15 |
&& rm -rf /var/lib/apt/lists/*
|
16 |
|
17 |
+
# Step 4: Set the working directory inside the container
|
18 |
WORKDIR /app
|
19 |
|
20 |
+
# Step 5: Copy the requirements file into the container
|
21 |
+
COPY requirements.txt /app/
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
# Step 6: Install the Python dependencies
|
24 |
RUN pip install --no-cache-dir -r requirements.txt
|
25 |
|
26 |
+
# Step 7: Copy the rest of the application files into the container
|
27 |
+
COPY . /app/
|
28 |
|
29 |
+
# Step 8: Expose the port that the Flask app will run on
|
30 |
EXPOSE 5000
|
31 |
|
32 |
+
# Step 9: Set the entry point to start the Flask application
|
33 |
+
CMD ["python", "app.py"]
|