arajshiva commited on
Commit
a21af0b
·
verified ·
1 Parent(s): eab78b0

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -9
Dockerfile CHANGED
@@ -1,17 +1,29 @@
1
 
2
  ######################## WRITE YOUR DOCKERFILE SCRIPT HERE #########################
3
- FROM python:3.9
 
4
 
5
- RUN useradd -m -u 1000 user
6
- USER user
7
- ENV PATH="/home/user/.local/bin:$PATH"
8
 
 
9
  WORKDIR /app
10
 
11
- COPY --chown=user ./requirements.txt requirements.txt
12
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
 
14
- COPY --chown=user . /app
 
 
15
 
16
- # Start the Streamlit app on port 7860, the default port expected by Spaces
17
- CMD ["streamlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
1
 
2
  ######################## WRITE YOUR DOCKERFILE SCRIPT HERE #########################
3
+ # Use official Python image
4
+ FROM python:3.10-slim
5
 
6
+ # Set environment variables
7
+ ENV PYTHONDONTWRITEBYTECODE=1
8
+ ENV PYTHONUNBUFFERED=1
9
 
10
+ # Set working directory
11
  WORKDIR /app
12
 
13
+ # Copy app code
14
+ COPY . .
15
 
16
+ # Install Python dependencies
17
+ RUN pip install --upgrade pip
18
+ RUN pip install -r requirements.txt
19
 
20
+ # Streamlit configuration (optional, tweak if needed)
21
+ ENV STREAMLIT_PORT=7860
22
+ ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
23
+ ENV STREAMLIT_SERVER_HEADLESS=true
24
+
25
+ # Expose default port for Streamlit
26
+ EXPOSE ${STREAMLIT_PORT}
27
+
28
+ # Command to run the app
29
+ CMD ["streamlit", "run", "app.py", "--server.port=${STREAMLIT_PORT}", "--server.enableCORS=false"]