entropy25 commited on
Commit
546a4bd
·
verified ·
1 Parent(s): d3c3044

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +46 -14
Dockerfile CHANGED
@@ -1,27 +1,59 @@
1
  FROM python:3.9-slim
2
 
3
- # Set the working directory
4
  WORKDIR /app
5
 
6
- # Install necessary system dependencies
7
  RUN apt-get update && apt-get install -y \
8
- curl \
9
- software-properties-common \
10
- git \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Copy requirements and application files
14
- COPY requirements.txt ./
15
- COPY *.py ./
16
 
17
  # Install Python dependencies
18
- RUN pip3 install -r requirements.txt
19
 
20
- # Expose Streamlit's default port
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  EXPOSE 8501
22
 
23
- # Health check to ensure the application is running properly
24
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
 
 
 
 
 
 
25
 
26
- # Set the Streamlit startup command
27
- ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  FROM python:3.9-slim
2
 
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
+ gcc \
8
+ g++ \
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Copy requirements first for better caching
12
+ COPY requirements.txt .
 
13
 
14
  # Install Python dependencies
15
+ RUN pip install --no-cache-dir -r requirements.txt
16
 
17
+ # Copy application code
18
+ COPY . .
19
+
20
+ # Create .streamlit directory and config
21
+ RUN mkdir -p ~/.streamlit/
22
+ RUN echo "\
23
+ [general]\n\
24
+ email = \"\"\n\
25
+ " > ~/.streamlit/credentials.toml
26
+
27
+ RUN echo "\
28
+ [server]\n\
29
+ headless = true\n\
30
+ enableCORS=false\n\
31
+ port = 8501\n\
32
+ " > ~/.streamlit/config.toml
33
+
34
+ # Expose port
35
  EXPOSE 8501
36
 
37
+ # Health check
38
+ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
39
+
40
+ # Run the application
41
+ CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0"]
42
+
43
+ # docker-compose.yml for easy deployment
44
+ version: '3.8'
45
 
46
+ services:
47
+ data-analysis-platform:
48
+ build: .
49
+ ports:
50
+ - "8501:8501"
51
+ environment:
52
+ - OPENAI_API_KEY=${OPENAI_API_KEY}
53
+ - GOOGLE_API_KEY=${GOOGLE_API_KEY}
54
+ volumes:
55
+ - ./data:/app/data
56
+ - ./exports:/app/exports
57
+ restart: unless-stopped
58
+ mem_limit: 2g
59
+ mem_reservation: 1g