mgbam commited on
Commit
f648aaa
Β·
verified Β·
1 Parent(s): 30db50a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -15
Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
  # Use official Python base image
2
  FROM python:3.10-slim
3
 
4
- # App metadata (for Hugging Face Spaces Docker SDK)
5
  LABEL title="MCP Research"
6
  LABEL emoji="πŸš€"
7
  LABEL colorFrom="red"
@@ -12,16 +12,16 @@ LABEL tags="streamlit"
12
  LABEL pinned="false"
13
  LABEL short_description="Streamlit template space"
14
 
15
- # Set environment variables for permissions and Streamlit config
16
  ENV PYTHONDONTWRITEBYTECODE=1
17
  ENV PYTHONUNBUFFERED=1
18
  ENV HOME=/app
19
  ENV STREAMLIT_CONFIG_DIR=/app/.streamlit
20
 
21
- # Create working directory
22
  WORKDIR /app
23
 
24
- # System deps (edit as needed for your MCP servers)
25
  RUN apt-get update && \
26
  apt-get install -y --no-install-recommends \
27
  build-essential \
@@ -32,18 +32,31 @@ RUN apt-get update && \
32
  COPY requirements.txt .
33
  RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
34
 
35
- # Copy the rest of your code
36
  COPY . .
37
 
38
- # Create .streamlit directory to avoid permission issues
39
- RUN mkdir -p /app/.streamlit
40
-
41
- # Optionally, add default Streamlit config (no telemetry, etc)
42
- RUN echo \"[server]\\nheadless = true\\nport = 8501\\naddress = 0.0.0.0\\n\" > /app/.streamlit/config.toml
43
-
44
- # Expose Streamlit's default port
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  EXPOSE 8501
46
 
47
- # Start the Streamlit app
48
- CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
49
-
 
1
  # Use official Python base image
2
  FROM python:3.10-slim
3
 
4
+ # App metadata for Hugging Face Spaces Docker SDK
5
  LABEL title="MCP Research"
6
  LABEL emoji="πŸš€"
7
  LABEL colorFrom="red"
 
12
  LABEL pinned="false"
13
  LABEL short_description="Streamlit template space"
14
 
15
+ # Set environment variables for Streamlit config and permissions
16
  ENV PYTHONDONTWRITEBYTECODE=1
17
  ENV PYTHONUNBUFFERED=1
18
  ENV HOME=/app
19
  ENV STREAMLIT_CONFIG_DIR=/app/.streamlit
20
 
21
+ # Set working directory
22
  WORKDIR /app
23
 
24
+ # System dependencies (edit as needed)
25
  RUN apt-get update && \
26
  apt-get install -y --no-install-recommends \
27
  build-essential \
 
32
  COPY requirements.txt .
33
  RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
34
 
35
+ # Copy all app source
36
  COPY . .
37
 
38
+ # Create .streamlit directory and set permissions
39
+ RUN mkdir -p /app/.streamlit && chmod -R 777 /app/.streamlit
40
+
41
+ # Add a default Streamlit config.toml (overwrite with your own if needed)
42
+ RUN echo "\
43
+ [server]\n\
44
+ headless = true\n\
45
+ port = 8501\n\
46
+ address = \"0.0.0.0\"\n\
47
+ enableCORS = false\n\
48
+ enableXsrfProtection = false\n\
49
+ \n\
50
+ [theme]\n\
51
+ primaryColor = \"#e63946\"\n\
52
+ backgroundColor = \"#0E1117\"\n\
53
+ secondaryBackgroundColor = \"#1a1a2e\"\n\
54
+ textColor = \"#FAFAFA\"\n\
55
+ font = \"sans serif\"\n\
56
+ " > /app/.streamlit/config.toml
57
+
58
+ # Expose the Streamlit port
59
  EXPOSE 8501
60
 
61
+ # Use shell-form CMD for Hugging Face Spaces compatibility
62
+ CMD streamlit run app.py --server.port=8501 --server.address=0.0.0.0