MogensR commited on
Commit
ad0434e
·
1 Parent(s): 9f9c501

Create docker/Dockerfile.cpu

Browse files
Files changed (1) hide show
  1. docker/Dockerfile.cpu +49 -0
docker/Dockerfile.cpu ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ============================================================================
2
+ # CPU-only Dockerfile for BackgroundFX Pro
3
+ # For development, testing, or CPU-only deployments
4
+ # ============================================================================
5
+
6
+ FROM python:3.10-slim
7
+
8
+ ENV PYTHONDONTWRITEBYTECODE=1 \
9
+ PYTHONUNBUFFERED=1 \
10
+ DEBIAN_FRONTEND=noninteractive \
11
+ DEVICE=cpu \
12
+ OMP_NUM_THREADS=4
13
+
14
+ # Install system dependencies
15
+ RUN apt-get update && apt-get install -y --no-install-recommends \
16
+ git wget curl \
17
+ ffmpeg \
18
+ libsm6 libxext6 libxrender1 libgl1-mesa-glx \
19
+ libglib2.0-0 libgomp1 \
20
+ && apt-get clean \
21
+ && rm -rf /var/lib/apt/lists/*
22
+
23
+ WORKDIR /app
24
+
25
+ # Install Python dependencies
26
+ COPY requirements-cpu.txt requirements.txt ./
27
+ RUN pip install --no-cache-dir --upgrade pip && \
28
+ pip install --no-cache-dir \
29
+ torch==2.1.0 --index-url https://download.pytorch.org/whl/cpu \
30
+ torchvision==0.16.0 --index-url https://download.pytorch.org/whl/cpu && \
31
+ pip install --no-cache-dir -r requirements.txt
32
+
33
+ # Create app user
34
+ RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
35
+ USER appuser
36
+
37
+ # Copy application
38
+ COPY --chown=appuser:appuser . .
39
+
40
+ # Create directories
41
+ RUN mkdir -p logs uploads outputs models/.cache
42
+
43
+ # Health check
44
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
45
+ CMD curl -f http://localhost:7860/health || exit 1
46
+
47
+ EXPOSE 7860 8000
48
+
49
+ CMD ["python", "-u", "app.py"]