File size: 1,016 Bytes
c1fd10a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1a46c5a
 
 
c1fd10a
 
 
1a46c5a
c1fd10a
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM python:3.11-slim


WORKDIR /app

# Install Git
RUN apt-get update && apt-get install -y git


ARG APP_FILE="app.py" 
ARG PORT="8501"


#Clone app repo or pull recent updates using tokens
RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \
    --mount=type=secret,id=GITHUB_REPO_URL,mode=0444,required=true \
    if [ -d "/app/cloned_repo/.git" ]; then \
        cd /app/cloned_repo && \
        git pull "https://$(cat /run/secrets/GITHUB_TOKEN)@$(cat /run/secrets/GITHUB_REPO_URL)"; \
    else \
        git clone "https://$(cat /run/secrets/GITHUB_TOKEN)@$(cat /run/secrets/GITHUB_REPO_URL)" /app/cloned_repo; \
    fi

# # Copy requirements.txt and install dependencies
# COPY requirements.txt .
# RUN pip install -r requirements.txt

# Change working directory to the cloned repository
WORKDIR /app/cloned_repo
RUN pip install -r requirements.txt

#Expose port for HF
EXPOSE 8501 

# Run the Streamlit app
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address", "0.0.0.0"]