File size: 1,712 Bytes
ad0434e
 
 
 
 
 
5aff2d4
ad0434e
 
 
 
5aff2d4
 
ad0434e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dc3baf7
 
 
 
 
ad0434e
 
 
 
 
dc3baf7
ad0434e
 
dc3baf7
ad0434e
 
 
 
 
 
 
 
dc3baf7
5aff2d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# ============================================================================
# CPU-only Dockerfile for BackgroundFX Pro
# For development, testing, or CPU-only deployments
# ============================================================================
FROM python:3.10-slim

# Set environment variables - INCLUDING MKL_NUM_THREADS to fix libgomp error
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    DEBIAN_FRONTEND=noninteractive \
    DEVICE=cpu \
    OMP_NUM_THREADS=4 \
    MKL_NUM_THREADS=4

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    git wget curl \
    ffmpeg \
    libsm6 libxext6 libxrender1 libgl1-mesa-glx \
    libglib2.0-0 libgomp1 \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install Python dependencies
COPY requirements-cpu.txt requirements.txt ./
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir \
      torch==2.1.0 --index-url https://download.pytorch.org/whl/cpu \
      torchvision==0.16.0 --index-url https://download.pytorch.org/whl/cpu && \
    pip install --no-cache-dir -r requirements.txt && \
    pip install --no-deps \
      git+https://github.com/pq-yang/MatAnyone.git@2234ce5cdc487749515518bd035b5e18bccea3da

# Create app user
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser

# Copy application code
COPY --chown=appuser:appuser . .

# Create runtime directories
RUN mkdir -p logs uploads outputs models/.cache

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
    CMD curl -f http://localhost:7860/health || exit 1

EXPOSE 7860 8000

# Launch
CMD ["python", "-u", "app.py"]