muhammadhamza-stack commited on
Commit
8ea59e4
·
1 Parent(s): 9e97488

dockerize the app

Browse files
Files changed (3) hide show
  1. Dockerfile +31 -0
  2. README.md +1 -1
  3. app.py +4 -1
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HF Spaces compatible base image
2
+ FROM python:3.9-slim
3
+
4
+ # Prevent Python from writing .pyc files
5
+ ENV PYTHONDONTWRITEBYTECODE=1
6
+ ENV PYTHONUNBUFFERED=1
7
+
8
+ # Set working directory
9
+ WORKDIR /app
10
+
11
+ # System dependencies (safe defaults)
12
+ RUN apt-get update && apt-get install -y \
13
+ git \
14
+ curl \
15
+ && rm -rf /var/lib/apt/lists/*
16
+
17
+ # Copy requirements first (better Docker caching)
18
+ COPY requirements.txt .
19
+
20
+ # Upgrade pip and install dependencies
21
+ RUN pip install --upgrade pip \
22
+ && pip install --no-cache-dir -r requirements.txt
23
+
24
+ # Copy the rest of the application
25
+ COPY . .
26
+
27
+ # Hugging Face Spaces uses port 7860
28
+ EXPOSE 7860
29
+
30
+ # Start the app
31
+ CMD ["python", "app.py"]
README.md CHANGED
@@ -3,7 +3,7 @@ title: Drawer Detection
3
  emoji: 📊
4
  colorFrom: blue
5
  colorTo: gray
6
- sdk: gradio
7
  sdk_version: 5.12.0
8
  app_file: app.py
9
  pinned: false
 
3
  emoji: 📊
4
  colorFrom: blue
5
  colorTo: gray
6
+ sdk: docker
7
  sdk_version: 5.12.0
8
  app_file: app.py
9
  pinned: false
app.py CHANGED
@@ -501,4 +501,7 @@ if __name__ == "__main__":
501
  )
502
 
503
  demo.queue()
504
- demo.launch(share=True)
 
 
 
 
501
  )
502
 
503
  demo.queue()
504
+ demo.launch(
505
+ server_name="0.0.0.0",
506
+ server_port=7860,
507
+ share=True)