add docker
Browse files- Dockerfile +35 -0
Dockerfile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a lightweight Python base image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
| 6 |
+
ENV PYTHONUNBUFFERED=1
|
| 7 |
+
|
| 8 |
+
# Set working directory
|
| 9 |
+
WORKDIR /app
|
| 10 |
+
|
| 11 |
+
# Install system dependencies
|
| 12 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 13 |
+
git \
|
| 14 |
+
build-essential \
|
| 15 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
+
|
| 17 |
+
# Install PyTorch CPU version
|
| 18 |
+
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
|
| 19 |
+
|
| 20 |
+
# Copy the segment-anything-2 repo and install it in editable mode
|
| 21 |
+
COPY segment-anything-2 ./segment-anything-2
|
| 22 |
+
RUN pip install -e ./segment-anything-2
|
| 23 |
+
|
| 24 |
+
# Copy the manual requirements and install them without dependencies
|
| 25 |
+
COPY requirements_manual.txt .
|
| 26 |
+
RUN pip install --no-deps -r requirements_manual.txt
|
| 27 |
+
|
| 28 |
+
# Copy rest of the app
|
| 29 |
+
COPY . .
|
| 30 |
+
|
| 31 |
+
# Expose Gradio/Streamlit default port
|
| 32 |
+
EXPOSE 7860
|
| 33 |
+
|
| 34 |
+
# Start the app (adjust depending on whether you're using Gradio or Streamlit)
|
| 35 |
+
CMD ["python", "app.py"]
|