Hasitha16 commited on
Commit
e83f844
Β·
verified Β·
1 Parent(s): a5cd287

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -5
Dockerfile CHANGED
@@ -7,27 +7,28 @@ RUN apt-get update && apt-get install -y \
7
  libsndfile1 ffmpeg git \
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
- # Copy files
11
  COPY . /code
12
 
13
- # Set environment for Streamlit and Transformers
14
  ENV PYTHONDONTWRITEBYTECODE=1
15
  ENV PYTHONUNBUFFERED=1
16
  ENV HF_HOME=/tmp/hf-home
17
  ENV TRANSFORMERS_CACHE=/tmp/hf-cache
18
  ENV NLTK_DATA=/tmp/nltk_data
19
- ENV XDG_CONFIG_HOME=/tmp
 
20
 
21
  # Install Python dependencies
22
  RUN pip install --upgrade pip
23
  RUN pip install -r requirements.txt
24
 
25
- # Make .streamlit dir in /tmp
26
  RUN mkdir -p /tmp/.streamlit
27
 
28
  # Expose ports
29
  EXPOSE 7860
30
  EXPOSE 8000
31
 
32
- # Run both frontend and backend
33
  CMD ["bash", "-c", "streamlit run frontend.py --server.port 7860 & uvicorn main:app --host 0.0.0.0 --port 8000"]
 
7
  libsndfile1 ffmpeg git \
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
+ # Copy project files
11
  COPY . /code
12
 
13
+ # Set safe cache + config + data paths
14
  ENV PYTHONDONTWRITEBYTECODE=1
15
  ENV PYTHONUNBUFFERED=1
16
  ENV HF_HOME=/tmp/hf-home
17
  ENV TRANSFORMERS_CACHE=/tmp/hf-cache
18
  ENV NLTK_DATA=/tmp/nltk_data
19
+ ENV HOME=/tmp # πŸ‘ˆ fixes default fallback for Streamlit
20
+ ENV XDG_CONFIG_HOME=/tmp # πŸ‘ˆ fixes config path
21
 
22
  # Install Python dependencies
23
  RUN pip install --upgrade pip
24
  RUN pip install -r requirements.txt
25
 
26
+ # Create writable .streamlit config folder
27
  RUN mkdir -p /tmp/.streamlit
28
 
29
  # Expose ports
30
  EXPOSE 7860
31
  EXPOSE 8000
32
 
33
+ # Final launch command
34
  CMD ["bash", "-c", "streamlit run frontend.py --server.port 7860 & uvicorn main:app --host 0.0.0.0 --port 8000"]