jefrisuparjanaAI commited on
Commit
73583fd
·
verified ·
1 Parent(s): e8d2d77

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +43 -0
Dockerfile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile for Hugging Face Spaces
2
+ FROM python:3.9-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ libhdf5-dev \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Copy requirements file
14
+ COPY requirements.txt .
15
+
16
+ # Install Python dependencies
17
+ RUN pip install --no-cache-dir --upgrade pip && \
18
+ pip install --no-cache-dir -r requirements.txt
19
+
20
+ # Copy application files
21
+ COPY app.py .
22
+ COPY test.html .
23
+
24
+ # Create directories for sample images
25
+ RUN mkdir -p Content_Images Style_Images
26
+
27
+ # Copy sample images if they exist (optional)
28
+ COPY Content_Images/* Content_Images/ 2>/dev/null || true
29
+ COPY Style_Images/* Style_Images/ 2>/dev/null || true
30
+
31
+ # Expose port 7860 (Hugging Face Spaces default)
32
+ EXPOSE 7860
33
+
34
+ # Set environment variables
35
+ ENV PORT=7860
36
+ ENV PYTHONUNBUFFERED=1
37
+
38
+ # Health check
39
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
40
+ CMD python -c "import requests; requests.get('http://localhost:7860/api/health')"
41
+
42
+ # Run the application
43
+ CMD ["python", "-u", "app.py"]