Sravs commited on
Commit
4cb425b
·
verified ·
1 Parent(s): b072b15

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -13
Dockerfile CHANGED
@@ -1,20 +1,27 @@
1
- FROM python:3.13.5-slim
2
 
3
- WORKDIR /app
 
 
 
 
4
 
5
- RUN apt-get update && apt-get install -y \
6
- build-essential \
7
- curl \
8
- git \
9
- && rm -rf /var/lib/apt/lists/*
10
 
11
- COPY requirements.txt ./
12
- COPY src/ ./src/
 
 
 
13
 
14
- RUN pip3 install -r requirements.txt
 
 
15
 
16
- EXPOSE 8501
 
17
 
18
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
 
19
 
20
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
1
 
2
+ # Fill in the base image with the correct Python version (e.g., python:3.9)
3
+ FROM python:3.9
4
+
5
+ # Fill in the username to be created (e.g., user)
6
+ RUN useradd -m -u 1000 user
7
 
8
+ # Blank #3: Specify the username for subsequent commands (e.g., user)
9
+ USER user
 
 
 
10
 
11
+ # Fill in the username in the PATH environment variable (e.g., user)
12
+ ENV PATH="/home/user/.local/bin:$PATH"
13
+
14
+ # Set working directory
15
+ WORKDIR /app
16
 
17
+ # Use the same username for file ownership when copying requirements (e.g., user)
18
+ COPY --chown=user ./requirements.txt requirements.txt
19
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
20
 
21
+ # Use the same username for file ownership when copying the app files (e.g., user)
22
+ COPY --chown=user . /app
23
 
24
+ # Start the Streamlit app on port 7860, the default port expected by Spaces
25
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
26
 
27
+ # Reference: https://huggingface.co/docs/hub/en/spaces-sdks-docker