Spaces:
Running
Running
abdullahmubeen10
commited on
Update Dockerfile
Browse files- Dockerfile +36 -40
Dockerfile
CHANGED
@@ -1,68 +1,64 @@
|
|
1 |
-
#
|
2 |
-
FROM ubuntu:
|
3 |
|
4 |
# Set environment variables
|
5 |
-
ENV NB_USER
|
6 |
-
ENV NB_UID
|
7 |
-
ENV HOME
|
8 |
-
ENV JAVA_HOME
|
9 |
|
10 |
-
#
|
11 |
-
RUN apt-get update && apt-get install -y \
|
12 |
-
|
13 |
wget \
|
|
|
|
|
14 |
bash \
|
15 |
rsync \
|
16 |
gcc \
|
17 |
libfreetype6-dev \
|
18 |
-
libhdf5-
|
19 |
libpng-dev \
|
20 |
-
|
21 |
-
python3 \
|
22 |
-
python3-dev \
|
23 |
-
python3-pip \
|
24 |
unzip \
|
25 |
pkg-config \
|
26 |
-
software-properties-common \
|
27 |
graphviz \
|
28 |
-
openjdk-
|
|
|
|
|
|
|
|
|
29 |
ant \
|
30 |
-
ca-certificates
|
31 |
&& apt-get clean \
|
32 |
&& update-ca-certificates -f
|
33 |
|
34 |
-
#
|
35 |
-
RUN
|
36 |
-
&& apt-get update \
|
37 |
-
&& apt-get install -y python3.8 python3-pip \
|
38 |
-
&& apt-get clean
|
39 |
-
|
40 |
-
# Set up JAVA_HOME
|
41 |
-
RUN echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/" >> /etc/profile \
|
42 |
&& echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/profile
|
43 |
-
|
|
|
|
|
|
|
|
|
44 |
RUN useradd -m -u ${NB_UID} ${NB_USER}
|
45 |
|
46 |
-
# Switch to the
|
47 |
USER ${NB_USER}
|
48 |
|
49 |
-
# Set
|
50 |
-
ENV HOME=/home/${NB_USER}
|
51 |
-
|
52 |
-
|
53 |
-
# Set up PySpark to use Python 3.8 for both driver and workers
|
54 |
-
ENV PYSPARK_PYTHON=/usr/bin/python3.8
|
55 |
-
ENV PYSPARK_DRIVER_PYTHON=/usr/bin/python3.8
|
56 |
|
57 |
-
# Set
|
58 |
-
|
|
|
59 |
|
60 |
-
#
|
61 |
-
RUN python3.8 -m pip install --upgrade pip
|
62 |
COPY requirements.txt /tmp/requirements.txt
|
63 |
-
RUN python3.
|
64 |
|
65 |
-
# Copy
|
66 |
COPY --chown=${NB_USER}:${NB_USER} . ${HOME}
|
67 |
|
68 |
# Expose port for Streamlit
|
|
|
1 |
+
# Use the latest Ubuntu LTS base image
|
2 |
+
FROM ubuntu:22.04
|
3 |
|
4 |
# Set environment variables
|
5 |
+
ENV NB_USER=jovyan
|
6 |
+
ENV NB_UID=1000
|
7 |
+
ENV HOME=/home/${NB_USER}
|
8 |
+
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/
|
9 |
|
10 |
+
# Upgrade the system and install required packages
|
11 |
+
RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y \
|
12 |
+
software-properties-common \
|
13 |
wget \
|
14 |
+
curl \
|
15 |
+
tar \
|
16 |
bash \
|
17 |
rsync \
|
18 |
gcc \
|
19 |
libfreetype6-dev \
|
20 |
+
libhdf5-dev \
|
21 |
libpng-dev \
|
22 |
+
libzmq5-dev \
|
|
|
|
|
|
|
23 |
unzip \
|
24 |
pkg-config \
|
|
|
25 |
graphviz \
|
26 |
+
openjdk-17-jdk \
|
27 |
+
python3.11 \
|
28 |
+
python3.11-dev \
|
29 |
+
python3.11-venv \
|
30 |
+
python3-pip \
|
31 |
ant \
|
32 |
+
ca-certificates \
|
33 |
&& apt-get clean \
|
34 |
&& update-ca-certificates -f
|
35 |
|
36 |
+
# Set up JAVA_HOME for OpenJDK 17 (latest stable release)
|
37 |
+
RUN echo "export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/" >> /etc/profile \
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
&& echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/profile
|
39 |
+
|
40 |
+
# Upgrade Python tools (pip, setuptools, wheel)
|
41 |
+
RUN python3.11 -m pip install --upgrade pip setuptools wheel
|
42 |
+
|
43 |
+
# Create a new user with a specific UID
|
44 |
RUN useradd -m -u ${NB_UID} ${NB_USER}
|
45 |
|
46 |
+
# Switch to the new user
|
47 |
USER ${NB_USER}
|
48 |
|
49 |
+
# Set user-specific environment variables
|
50 |
+
ENV HOME=/home/${NB_USER}
|
51 |
+
ENV PATH=/home/${NB_USER}/.local/bin:$PATH
|
|
|
|
|
|
|
|
|
52 |
|
53 |
+
# Set up PySpark to use Python 3.11 for both driver and workers
|
54 |
+
ENV PYSPARK_PYTHON=/usr/bin/python3.11
|
55 |
+
ENV PYSPARK_DRIVER_PYTHON=/usr/bin/python3.11
|
56 |
|
57 |
+
# Install the latest Python dependencies from requirements.txt
|
|
|
58 |
COPY requirements.txt /tmp/requirements.txt
|
59 |
+
RUN python3.11 -m pip install --upgrade -r /tmp/requirements.txt
|
60 |
|
61 |
+
# Copy application code to the container
|
62 |
COPY --chown=${NB_USER}:${NB_USER} . ${HOME}
|
63 |
|
64 |
# Expose port for Streamlit
|