RoophaSharon commited on
Commit
51c62ea
·
1 Parent(s): a668bc0

Add Dockerfile and switch HF Space config to Docker SDK (port 7860)

Browse files
Files changed (2) hide show
  1. Dockerfile +28 -0
  2. README.md +2 -2
Dockerfile ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ # System deps (build tools for some wheels, curl for healthcheck)
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ build-essential curl \
6
+ && rm -rf /var/lib/apt/lists/*
7
+
8
+ # Run as non-root user (Hugging Face Spaces convention: uid 1000)
9
+ RUN useradd -m -u 1000 user
10
+ USER user
11
+ ENV HOME=/home/user \
12
+ PATH=/home/user/.local/bin:$PATH
13
+
14
+ WORKDIR $HOME/app
15
+
16
+ # Install Python dependencies first (better layer caching)
17
+ COPY --chown=user requirements.txt .
18
+ RUN pip install --no-cache-dir --upgrade pip \
19
+ && pip install --no-cache-dir -r requirements.txt
20
+
21
+ # Copy the rest of the app
22
+ COPY --chown=user . .
23
+
24
+ # Hugging Face Spaces expects the app on port 7860
25
+ EXPOSE 7860
26
+
27
+ CMD ["streamlit", "run", "demo.py", \
28
+ "--server.port=7860", "--server.address=0.0.0.0"]
README.md CHANGED
@@ -3,8 +3,8 @@ title: Metadata Hierarchy Explorer
3
  emoji: 🌿
4
  colorFrom: green
5
  colorTo: blue
6
- sdk: streamlit
7
- app_file: demo.py
8
  pinned: false
9
  license: mit
10
  ---
 
3
  emoji: 🌿
4
  colorFrom: green
5
  colorTo: blue
6
+ sdk: docker
7
+ app_port: 7860
8
  pinned: false
9
  license: mit
10
  ---