Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +11 -11
Dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
-
# Dockerfile
|
|
|
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Install system dependencies
|
|
@@ -12,25 +12,25 @@ RUN apt-get update && apt-get install -y \
|
|
| 12 |
wget \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
-
# Copy requirements first
|
| 16 |
COPY requirements.txt .
|
| 17 |
|
| 18 |
# Install Python dependencies
|
| 19 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
|
| 21 |
# Copy application files
|
| 22 |
-
COPY
|
| 23 |
|
| 24 |
# Create necessary directories with permissions
|
| 25 |
-
RUN mkdir -p uploads
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
# Expose port
|
| 29 |
EXPOSE 7860
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
| 33 |
-
CMD python -c "import requests; requests.get('http://localhost:7860/')"
|
| 34 |
-
|
| 35 |
-
# Run the application
|
| 36 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Dockerfile for AI Background Changer
|
| 2 |
+
|
| 3 |
FROM python:3.10-slim
|
| 4 |
|
|
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Install system dependencies
|
|
|
|
| 12 |
wget \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
+
# Copy requirements first
|
| 16 |
COPY requirements.txt .
|
| 17 |
|
| 18 |
# Install Python dependencies
|
| 19 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
|
| 21 |
# Copy application files
|
| 22 |
+
COPY . .
|
| 23 |
|
| 24 |
# Create necessary directories with permissions
|
| 25 |
+
RUN mkdir -p uploads results models && chmod -R 777 uploads results models
|
| 26 |
+
|
| 27 |
+
# Download SAM model if not present (optional - you have it locally)
|
| 28 |
+
# RUN if [ ! -f models/sam_vit_b_01ec64.pth ]; then \
|
| 29 |
+
# wget -P models/ https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth; \
|
| 30 |
+
# fi
|
| 31 |
|
| 32 |
# Expose port
|
| 33 |
EXPOSE 7860
|
| 34 |
|
| 35 |
+
# Run application
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|