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"] |