fahrendrakhoirul commited on
Commit
d83f85f
·
verified ·
1 Parent(s): c25d896

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -30
Dockerfile CHANGED
@@ -1,46 +1,22 @@
1
  FROM python:3.9-slim
2
 
3
- # Set working directory
4
  WORKDIR /app
 
5
 
6
- # Avoid interactive prompts
7
- ENV DEBIAN_FRONTEND=noninteractive
8
- ENV STREAMLIT_HOME=/app/.streamlit
9
- ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
10
-
11
- # Install system dependencies
12
  RUN apt-get update && apt-get install -y \
13
  build-essential \
14
- git \
15
  curl \
 
16
  && rm -rf /var/lib/apt/lists/*
17
-
18
- # Copy requirements and install Python dependencies
19
  COPY requirements.txt .
20
- RUN pip install --upgrade pip && pip install -r requirements.txt
21
-
22
- # Create directories for Streamlit and HuggingFace to avoid permission errors
23
- RUN mkdir -p $STREAMLIT_HOME && mkdir -p $TRANSFORMERS_CACHE
24
- RUN echo "\
25
- [server]\n\
26
- headless = true\n\
27
- enableCORS = false\n\
28
- port = 8501\n\
29
- " > $STREAMLIT_HOME/config.toml
30
 
31
- # Download Hugging Face model (pre-cache)
32
- RUN python -c "from transformers import AutoModel, AutoTokenizer; \
33
- AutoModel.from_pretrained('indobenchmark/indobert-base-p1'); \
34
- AutoTokenizer.from_pretrained('indobenchmark/indobert-base-p1')"
35
 
36
- # Copy project files
37
  COPY . .
38
 
39
- # Expose Streamlit port
40
  EXPOSE 8501
41
 
42
- # Healthcheck (optional)
43
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
44
 
45
- # Run Streamlit
46
- 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
+ ENV HOME=/app
5
 
 
 
 
 
 
 
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
 
8
  curl \
9
+ git \
10
  && rm -rf /var/lib/apt/lists/*
11
+
 
12
  COPY requirements.txt .
 
 
 
 
 
 
 
 
 
 
13
 
14
+ RUN pip3 install -r requirements.txt
 
 
 
15
 
 
16
  COPY . .
17
 
 
18
  EXPOSE 8501
19
 
20
+ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
 
21
 
22
+ ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]