Add git installation to Dockerfile
Browse files- Dockerfile +14 -18
Dockerfile
CHANGED
|
@@ -1,29 +1,25 @@
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
-
|
|
|
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
| 7 |
-
git \
|
| 8 |
-
build-essential \
|
| 9 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
-
#
|
| 12 |
COPY requirements.txt .
|
| 13 |
-
|
| 14 |
-
# Install Python dependencies
|
| 15 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
-
# Copy
|
| 18 |
COPY . .
|
| 19 |
|
| 20 |
-
#
|
| 21 |
-
|
|
|
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
| 25 |
-
ENV STREAMLIT_SERVER_ENABLECORS=false
|
| 26 |
-
ENV STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION=false
|
| 27 |
|
| 28 |
-
# Run
|
| 29 |
-
CMD ["streamlit", "run", "app.py"
|
|
|
|
| 1 |
+
# Use the official Python 3.9 slim image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# 1. Install git (This fixes the /bin/sh: git: not found error!)
|
| 5 |
+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
| 6 |
|
| 7 |
+
# 2. Set the working directory
|
| 8 |
+
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
# 3. Install Python dependencies
|
| 11 |
COPY requirements.txt .
|
|
|
|
|
|
|
| 12 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 13 |
|
| 14 |
+
# 4. Copy the rest of your files
|
| 15 |
COPY . .
|
| 16 |
|
| 17 |
+
# 5. Force Streamlit to use the correct port
|
| 18 |
+
RUN mkdir -p ~/.streamlit && \
|
| 19 |
+
echo "[server]\nport = 7860\naddress = \"0.0.0.0\"\n" > ~/.streamlit/config.toml
|
| 20 |
|
| 21 |
+
# 6. Expose port 7860
|
| 22 |
+
EXPOSE 7860
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
# 7. Run the app
|
| 25 |
+
CMD ["streamlit", "run", "app.py"]
|