SoggyBurritos commited on
Commit
3f7b976
·
verified ·
1 Parent(s): da03cc7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -7
Dockerfile CHANGED
@@ -1,21 +1,34 @@
1
- FROM python:3.9-slim
 
2
 
3
- WORKDIR /app
 
4
 
 
5
  RUN apt-get update && apt-get install -y \
6
  build-essential \
7
  curl \
8
- software-properties-common \
9
  git \
 
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- COPY requirements.txt ./
13
- COPY src/ ./src/
14
 
15
- RUN pip3 install -r requirements.txt
 
16
 
 
 
 
 
 
 
 
 
17
  EXPOSE 8501
18
 
19
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
20
 
21
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
1
+ # Use an official Python runtime as a parent image.
2
+ FROM docker.io/library/python:3.10-slim-bullseye
3
 
4
+ # Set the working directory in the container.
5
+ WORKDIR /lit
6
 
7
+ # Install system dependencies required by PyTorch and others.
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
  curl \
 
11
  git \
12
+ libgl1-mesa-glx \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
+ # Copy your requirements.txt file into the container and install dependencies.
16
+ COPY requirements.txt .
17
 
18
+ # Update pip and setuptools before installing other dependencies to prevent errors
19
+ RUN pip install --upgrade pip setuptools
20
 
21
+ RUN pip install --no-cache-dir -r requirements.txt
22
+
23
+ # Copy your entire application code (all the files & directories where the Dockerfile is), including the model weights, into the container.
24
+ # This assumes your model is at ./app/models/Spam-Classifier-GPT2-Model.pt relative to the project hugging face root.
25
+ # Another example, copies ./app/main.py
26
+ COPY . /lit
27
+
28
+ # Expose the port that Streamlit runs on.
29
  EXPOSE 8501
30
 
31
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
32
 
33
+ # Command to run the Streamlit application when the container starts. (starting from /lit)
34
+ ENTRYPOINT ["streamlit", "run", "app/main.py", "--server.port=8501", "--server.address=0.0.0.0", "--browser.gatherUsageStats=false", "--server.fileWatcherType=none"]