akashjayampu commited on
Commit
138f148
·
verified ·
1 Parent(s): b544ce2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -16
Dockerfile CHANGED
@@ -1,29 +1,26 @@
1
- # Use lightweight Python 3.9 image
2
  FROM python:3.9-slim
3
 
 
 
 
4
  WORKDIR /app
5
 
6
  # Install dependencies
7
- RUN apt-get update && apt-get install -y \
8
- git curl build-essential && rm -rf /var/lib/apt/lists/*
9
-
10
  COPY requirements.txt .
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
- COPY src/ ./src/
 
14
 
15
- # Set Hugging Face cache directory
16
- ENV HF_HOME=/app/.cache/huggingface
17
- ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/transformers
18
-
19
- # Accept token securely at build time
20
  ARG HF_TOKEN
21
- RUN echo "machine huggingface.co\n login ${HF_TOKEN}" > /root/.netrc && chmod 600 /root/.netrc
22
 
23
- # Skip pre-download here (let Streamlit download at runtime securely)
24
- # If you really want pre-download, use this ONLY if token works
25
- # RUN python3 -c "from transformers import pipeline; pipeline('summarization', model='mistralai/Mistral-7B-Instruct-v0.1', use_auth_token=True)"
26
 
27
- # Port and entrypoint
28
  EXPOSE 8501
29
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
 
 
1
  FROM python:3.9-slim
2
 
3
+ # Set environment variables for Hugging Face cache
4
+ ENV HF_HOME=/app/.cache/huggingface
5
+
6
  WORKDIR /app
7
 
8
  # Install dependencies
 
 
 
9
  COPY requirements.txt .
10
  RUN pip install --no-cache-dir -r requirements.txt
11
 
12
+ # Copy your app source code
13
+ COPY src/ ./src
14
 
15
+ # Set environment variable for HF token (pass your real token at build/run time or use build args)
 
 
 
 
16
  ARG HF_TOKEN
17
+ ENV HF_TOKEN=${HF_TOKEN}
18
 
19
+ # Optional: pre-download models (skip if gated or use runtime download)
20
+ # RUN python3 -c "from transformers import pipeline; pipeline('sentiment-analysis', model='distilbert-base-uncased-finetuned-sst-2-english')"
 
21
 
22
+ # Expose port for Streamlit
23
  EXPOSE 8501
24
+
25
+ # Run your Streamlit app
26
+ CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]