ganesh3 commited on
Commit
f7e66ef
·
verified ·
1 Parent(s): df01999

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -20
Dockerfile CHANGED
@@ -1,37 +1,35 @@
1
- # Use an official Python runtime as a parent image
2
  FROM python:3.9-slim
3
 
4
- # Set the working directory in the container
5
- WORKDIR /app
6
 
7
  # Install system dependencies
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
  curl \
11
- software-properties-common \
12
  python3-dev \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # Copy the requirements file into the container
16
  COPY requirements.txt .
 
 
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
- # Create necessary directories
20
- RUN mkdir -p app/pages config data grafana logs /root/.streamlit
 
 
21
 
22
- # Set Python path and Streamlit configs
23
- ENV PYTHONPATH=/app \
24
- STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \
25
- STREAMLIT_THEME_PRIMARY_COLOR="#FF4B4B" \
26
- STREAMLIT_SERVER_PORT=8501 \
27
- STREAMLIT_SERVER_ADDRESS=0.0.0.0
28
 
29
- # Create empty __init__.py files
30
- RUN touch app/__init__.py app/pages/__init__.py
31
 
32
- # Copy the application code and other files into the container
33
- COPY app/ ./app/
34
- COPY data/ ./data/
35
- COPY grafana/ ./grafana/
36
 
37
- CMD ["streamlit", "run", "app/home.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
 
 
1
  FROM python:3.9-slim
2
 
3
+ WORKDIR /code
 
4
 
5
  # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  curl \
9
+ git \
10
  python3-dev \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Copy requirements first to leverage Docker cache
14
  COPY requirements.txt .
15
+
16
+ # Install Python dependencies
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
+ # Copy application code
20
+ COPY ./app /code/app
21
+ COPY ./data /code/data
22
+ COPY ./config /code/config
23
 
24
+ # Create necessary directories
25
+ RUN mkdir -p /code/data /code/logs
 
 
 
 
26
 
27
+ # Make port 7860 available
28
+ EXPOSE 7860
29
 
30
+ # Set environment variables
31
+ ENV PYTHONPATH=/code
32
+ ENV PORT=7860
 
33
 
34
+ # Start command
35
+ CMD streamlit run /code/app/home.py --server.address=0.0.0.0 --server.port=7860