sd commited on
Commit
c48a310
·
verified ·
1 Parent(s): 0c90389

Upload 2 files

Browse files
Files changed (2) hide show
  1. Dockerfile +50 -18
  2. start.sh +9 -9
Dockerfile CHANGED
@@ -1,32 +1,64 @@
1
- FROM python:3.10-slim
2
 
3
- # System dependencies
 
 
 
 
 
4
  RUN apt-get update && apt-get install -y \
 
 
 
5
  libgl1 \
6
  libglib2.0-0 \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  && rm -rf /var/lib/apt/lists/*
8
 
9
- # Create app user and directory
10
- RUN useradd -m -u 1000 user
11
- WORKDIR /app
 
 
 
12
 
13
- # Copy requirements first for caching
14
- COPY app/requirements.txt requirements.txt
15
- RUN pip install --no-cache-dir --upgrade pip && \
16
- pip install --no-cache-dir torch torchvision && \
17
- pip install --no-cache-dir -r requirements.txt
18
 
19
- # Copy application code
20
- COPY app/ .
 
 
21
 
22
- # Create output directory
23
- RUN mkdir -p /app/output_images && chown -R user:user /app
 
24
 
25
- # Switch to non-root user
 
26
  USER user
 
 
27
 
28
- # Expose port
29
  EXPOSE 7860
30
 
31
- # Run the app
32
- CMD ["python", "flask_app.py"]
 
1
+ FROM pytorch/pytorch:2.1.0-cuda11.8-cudnn8-devel
2
 
3
+ WORKDIR /app
4
+
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+
7
+ # Install system dependencies for both apps
8
+ # Includes OpenCV deps, Font rendering, and build tools
9
  RUN apt-get update && apt-get install -y \
10
+ wget \
11
+ fontconfig \
12
+ libfontconfig1 \
13
  libgl1 \
14
  libglib2.0-0 \
15
+ libsm6 \
16
+ libxext6 \
17
+ libxrender1 \
18
+ libasound2 \
19
+ fonts-dejavu-core \
20
+ fonts-liberation \
21
+ fonts-noto-core \
22
+ fonts-noto-extra \
23
+ fonts-noto-color-emoji \
24
+ libraqm0 \
25
+ libfreetype6 \
26
+ libfribidi0 \
27
+ libharfbuzz0b \
28
+ libprotobuf-dev \
29
+ protobuf-compiler \
30
+ git \
31
  && rm -rf /var/lib/apt/lists/*
32
 
33
+ # Copy root requirements and install
34
+ COPY requirements.txt .
35
+ RUN pip install --no-cache-dir -r requirements.txt
36
+
37
+ # Copy all application code
38
+ COPY . .
39
 
40
+ # Download high-quality fonts for id-maker to bypass Git LFS issues
41
+ RUN mkdir -p id-maker/assets && \
42
+ wget -O id-maker/assets/tahomabd.ttf "https://raw.githubusercontent.com/Esmaill1/color-stealer/main/tahomabd.ttf" && \
43
+ wget -O id-maker/assets/TYBAH.TTF "https://raw.githubusercontent.com/Esmaill1/color-stealer/main/TYBAH.TTF" && \
44
+ wget -O id-maker/assets/arialbd.ttf "https://raw.githubusercontent.com/Esmaill1/color-stealer/main/arialbd.ttf"
45
 
46
+ # Set up storage directories and permissions
47
+ WORKDIR /app
48
+ RUN mkdir -p id-maker/storage/uploads id-maker/storage/processed id-maker/storage/results && \
49
+ chmod -R 777 /app
50
 
51
+ # Create the startup script to run both services
52
+ COPY start.sh .
53
+ RUN chmod +x start.sh
54
 
55
+ # Configure Hugging Face user
56
+ RUN useradd -m -u 1000 user
57
  USER user
58
+ ENV HOME=/home/user \
59
+ PATH=/home/user/.local/bin:$PATH
60
 
 
61
  EXPOSE 7860
62
 
63
+ # Start both services
64
+ CMD ["./start.sh"]
start.sh CHANGED
@@ -1,9 +1,9 @@
1
- #!/bin/bash
2
-
3
- # Start ID Maker on the main HF port (7860)
4
- export PORT=7860
5
- # CODEFORMER_API_URL is NOT set here, so it will use the value in id-maker/config/settings.json
6
- # (which points to the external HF Space)
7
-
8
- echo "Starting ID Maker Web UI on port $PORT..."
9
- cd /app/id-maker && python web/server.py
 
1
+ #!/bin/bash
2
+
3
+ # Start ID Maker on the main HF port (7860)
4
+ export PORT=7860
5
+ # CODEFORMER_API_URL is NOT set here, so it will use the value in id-maker/config/settings.json
6
+ # (which points to the external HF Space)
7
+
8
+ echo "Starting ID Maker Web UI on port $PORT..."
9
+ cd /app/id-maker && python web/server.py