Spaces:
Runtime error
Runtime error
NextDrought
commited on
Commit
•
59977de
1
Parent(s):
f6a12f6
Remove some dulicate lines and based on python3.10 instead of slim
Browse files- Dockerfile +5 -27
Dockerfile
CHANGED
@@ -1,9 +1,12 @@
|
|
1 |
# Stage 1: Build stage
|
2 |
-
FROM python:3.10
|
3 |
|
4 |
# Set the working directory in the container
|
5 |
WORKDIR /app
|
6 |
|
|
|
|
|
|
|
7 |
# Install system dependencies
|
8 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
9 |
build-essential \
|
@@ -20,39 +23,14 @@ ENV CPLUS_INCLUDE_PATH=/usr/include/gdal
|
|
20 |
ENV C_INCLUDE_PATH=/usr/include/gdal
|
21 |
|
22 |
# Copy the requirements file into the container
|
23 |
-
COPY
|
24 |
|
25 |
# Install Python dependencies
|
26 |
RUN pip install --no-cache-dir --upgrade pip \
|
27 |
&& pip install --no-cache-dir -r requirements.txt
|
28 |
|
29 |
-
# Stage 2: Final stage
|
30 |
-
FROM python:3.10-slim AS final-stage
|
31 |
-
|
32 |
-
# Set the working directory in the container
|
33 |
-
WORKDIR /app
|
34 |
-
|
35 |
-
# Install runtime dependencies
|
36 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
37 |
-
libpq5 \
|
38 |
-
gdal-bin \
|
39 |
-
&& rm -rf /var/lib/apt/lists/*
|
40 |
-
|
41 |
-
# Copy Python packages and dependencies from build stage
|
42 |
-
COPY --from=build-stage /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
|
43 |
-
COPY --from=build-stage /usr/local/bin /usr/local/bin
|
44 |
-
|
45 |
-
# Copy your application code
|
46 |
-
COPY . .
|
47 |
-
|
48 |
-
# Change permissions to allow all users to write to the /app directory
|
49 |
-
RUN chmod 777 /app
|
50 |
-
|
51 |
# Expose port 8501 for Streamlit
|
52 |
EXPOSE 8501
|
53 |
|
54 |
-
# Define environment variable for Streamlit
|
55 |
-
ENV STREAMLIT_PORT=8501
|
56 |
-
|
57 |
# Command to run the Streamlit app
|
58 |
CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0"]
|
|
|
1 |
# Stage 1: Build stage
|
2 |
+
FROM python:3.10
|
3 |
|
4 |
# Set the working directory in the container
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Change permissions to allow all users to write to the /app directory
|
8 |
+
RUN chmod 777 /app
|
9 |
+
|
10 |
# Install system dependencies
|
11 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
12 |
build-essential \
|
|
|
23 |
ENV C_INCLUDE_PATH=/usr/include/gdal
|
24 |
|
25 |
# Copy the requirements file into the container
|
26 |
+
COPY . .
|
27 |
|
28 |
# Install Python dependencies
|
29 |
RUN pip install --no-cache-dir --upgrade pip \
|
30 |
&& pip install --no-cache-dir -r requirements.txt
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
# Expose port 8501 for Streamlit
|
33 |
EXPOSE 8501
|
34 |
|
|
|
|
|
|
|
35 |
# Command to run the Streamlit app
|
36 |
CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0"]
|