Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +11 -4
Dockerfile
CHANGED
@@ -1,6 +1,9 @@
|
|
|
|
1 |
FROM python:3.10-slim
|
2 |
|
3 |
WORKDIR /app
|
|
|
|
|
4 |
ENV HF_HOME=/tmp/huggingface
|
5 |
ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
|
6 |
ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
|
@@ -10,8 +13,8 @@ ENV MPLCONFIGDIR=/tmp/matplotlib
|
|
10 |
ENV CUDA_VISIBLE_DEVICES=""
|
11 |
ENV HOME=/tmp
|
12 |
|
13 |
-
# Install system dependencies
|
14 |
-
RUN apt-get update && apt-get install -y \
|
15 |
git \
|
16 |
build-essential \
|
17 |
libgl1-mesa-glx \
|
@@ -25,7 +28,7 @@ RUN apt-get update && apt-get install -y \
|
|
25 |
libopencv-dev \
|
26 |
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
27 |
|
28 |
-
# Install Point-E and dependencies
|
29 |
RUN pip install --no-cache-dir -U pip && \
|
30 |
pip install --no-cache-dir torch==1.13.1 torchvision==0.14.1 --index-url https://download.pytorch.org/whl/cpu && \
|
31 |
pip install --no-cache-dir flask flask-cors open3d opencv-python-headless requests tqdm && \
|
@@ -36,8 +39,8 @@ RUN pip install --no-cache-dir -U pip && \
|
|
36 |
RUN mkdir -p /tmp/point_e_models
|
37 |
|
38 |
# Copy application code and download script
|
39 |
-
COPY app.py .
|
40 |
COPY download_weights.py .
|
|
|
41 |
|
42 |
# Run the download script as part of the container build
|
43 |
RUN python download_weights.py
|
@@ -45,5 +48,9 @@ RUN python download_weights.py
|
|
45 |
# Expose the port for the Flask server
|
46 |
EXPOSE 7860
|
47 |
|
|
|
|
|
|
|
|
|
48 |
# Command to run the application
|
49 |
CMD ["python", "app.py"]
|
|
|
1 |
+
# Dockerfile - Improved with more efficient caching and smaller image size
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
WORKDIR /app
|
5 |
+
|
6 |
+
# Set environment variables
|
7 |
ENV HF_HOME=/tmp/huggingface
|
8 |
ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
|
9 |
ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
|
|
|
13 |
ENV CUDA_VISIBLE_DEVICES=""
|
14 |
ENV HOME=/tmp
|
15 |
|
16 |
+
# Install system dependencies - grouped to reduce layers and image size
|
17 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
18 |
git \
|
19 |
build-essential \
|
20 |
libgl1-mesa-glx \
|
|
|
28 |
libopencv-dev \
|
29 |
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
30 |
|
31 |
+
# Install Point-E and dependencies - ordered from least to most likely to change
|
32 |
RUN pip install --no-cache-dir -U pip && \
|
33 |
pip install --no-cache-dir torch==1.13.1 torchvision==0.14.1 --index-url https://download.pytorch.org/whl/cpu && \
|
34 |
pip install --no-cache-dir flask flask-cors open3d opencv-python-headless requests tqdm && \
|
|
|
39 |
RUN mkdir -p /tmp/point_e_models
|
40 |
|
41 |
# Copy application code and download script
|
|
|
42 |
COPY download_weights.py .
|
43 |
+
COPY app.py .
|
44 |
|
45 |
# Run the download script as part of the container build
|
46 |
RUN python download_weights.py
|
|
|
48 |
# Expose the port for the Flask server
|
49 |
EXPOSE 7860
|
50 |
|
51 |
+
# Add healthcheck
|
52 |
+
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
53 |
+
CMD curl -f http://localhost:7860/health || exit 1
|
54 |
+
|
55 |
# Command to run the application
|
56 |
CMD ["python", "app.py"]
|