Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +9 -14
Dockerfile
CHANGED
|
@@ -1,19 +1,14 @@
|
|
| 1 |
-
# Use a lightweight Python image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Set environment variables for Hugging Face cache and CPU-only execution
|
| 8 |
ENV HF_HOME=/tmp/huggingface
|
| 9 |
ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
|
| 10 |
ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
|
| 11 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 12 |
ENV PYTHONUNBUFFERED=1
|
| 13 |
-
# Disable GPU detection
|
| 14 |
ENV CUDA_VISIBLE_DEVICES=""
|
| 15 |
|
| 16 |
-
|
| 17 |
RUN apt-get update && apt-get install -y \
|
| 18 |
build-essential \
|
| 19 |
libgl1-mesa-glx \
|
|
@@ -25,25 +20,25 @@ RUN apt-get update && apt-get install -y \
|
|
| 25 |
libopenblas-dev \
|
| 26 |
liblapack-dev \
|
| 27 |
git \
|
|
|
|
| 28 |
&& apt-get clean \
|
| 29 |
&& rm -rf /var/lib/apt/lists/*
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
# Create necessary directories with appropriate permissions
|
| 34 |
RUN mkdir -p /tmp/uploads /tmp/results /tmp/huggingface/transformers /tmp/huggingface/datasets \
|
| 35 |
&& chmod -R 777 /tmp/uploads /tmp/results /tmp/huggingface
|
| 36 |
|
| 37 |
-
# Copy requirements file and install dependencies
|
| 38 |
COPY requirements.txt .
|
| 39 |
-
RUN
|
| 40 |
-
pip install --no-cache-dir -
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
# Copy application code
|
| 43 |
COPY app.py .
|
| 44 |
|
| 45 |
-
|
|
|
|
| 46 |
EXPOSE 7860
|
| 47 |
|
| 48 |
-
# Command to run the application
|
| 49 |
CMD ["python", "app.py"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
ENV HF_HOME=/tmp/huggingface
|
| 6 |
ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
|
| 7 |
ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
|
| 8 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 9 |
ENV PYTHONUNBUFFERED=1
|
|
|
|
| 10 |
ENV CUDA_VISIBLE_DEVICES=""
|
| 11 |
|
|
|
|
| 12 |
RUN apt-get update && apt-get install -y \
|
| 13 |
build-essential \
|
| 14 |
libgl1-mesa-glx \
|
|
|
|
| 20 |
libopenblas-dev \
|
| 21 |
liblapack-dev \
|
| 22 |
git \
|
| 23 |
+
libopencv-dev \
|
| 24 |
&& apt-get clean \
|
| 25 |
&& rm -rf /var/lib/apt/lists/*
|
| 26 |
|
|
|
|
|
|
|
|
|
|
| 27 |
RUN mkdir -p /tmp/uploads /tmp/results /tmp/huggingface/transformers /tmp/huggingface/datasets \
|
| 28 |
&& chmod -R 777 /tmp/uploads /tmp/results /tmp/huggingface
|
| 29 |
|
|
|
|
| 30 |
COPY requirements.txt .
|
| 31 |
+
RUN python -m venv /venv && \
|
| 32 |
+
/venv/bin/pip install --no-cache-dir -U pip && \
|
| 33 |
+
/venv/bin/pip install --no-cache-dir -r requirements.txt
|
| 34 |
+
|
| 35 |
+
RUN git clone https://github.com/baaivision/LGM.git /app/lgm && \
|
| 36 |
+
/venv/bin/pip install --no-cache-dir /app/lgm
|
| 37 |
|
|
|
|
| 38 |
COPY app.py .
|
| 39 |
|
| 40 |
+
ENV PATH="/venv/bin:$PATH"
|
| 41 |
+
|
| 42 |
EXPOSE 7860
|
| 43 |
|
|
|
|
| 44 |
CMD ["python", "app.py"]
|