ngebodh commited on
Commit
c1fd10a
·
verified ·
1 Parent(s): c9d0bd5

Set up app Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +35 -0
Dockerfile ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+
4
+ WORKDIR /app
5
+
6
+ # Install Git
7
+ RUN apt-get update && apt-get install -y git
8
+
9
+
10
+ ARG APP_FILE="app.py"
11
+ ARG PORT="8501"
12
+
13
+
14
+ #Clone app repo or pull recent updates using tokens
15
+ RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \
16
+ --mount=type=secret,id=GITHUB_REPO_URL,mode=0444,required=true \
17
+ if [ -d "/app/cloned_repo/.git" ]; then \
18
+ cd /app/cloned_repo && \
19
+ git pull "https://$(cat /run/secrets/GITHUB_TOKEN)@$(cat /run/secrets/GITHUB_REPO_URL)"; \
20
+ else \
21
+ git clone "https://$(cat /run/secrets/GITHUB_TOKEN)@$(cat /run/secrets/GITHUB_REPO_URL)" /app/cloned_repo; \
22
+ fi
23
+
24
+ # Copy requirements.txt and install dependencies
25
+ COPY requirements.txt .
26
+ RUN pip install -r requirements.txt
27
+
28
+ # Change working directory to the cloned repository
29
+ WORKDIR /app/cloned_repo
30
+
31
+ #Expose port for HF
32
+ EXPOSE 8501
33
+
34
+ # Run the Streamlit app
35
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address", "0.0.0.0"]