Spaces:
Sleeping
Sleeping
abdullahmubeen10
commited on
Update Dockerfile
Browse files- Dockerfile +23 -23
Dockerfile
CHANGED
@@ -1,28 +1,21 @@
|
|
1 |
-
# Download base image ubuntu
|
2 |
-
FROM ubuntu:
|
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-
|
9 |
|
10 |
-
#
|
11 |
-
ENV DEBIAN_FRONTEND=noninteractive
|
12 |
-
|
13 |
-
# Create a new user named "jovyan" with user ID 1000
|
14 |
-
RUN useradd -m -u ${NB_UID} ${NB_USER}
|
15 |
-
|
16 |
-
# Install required packages and set up timezone
|
17 |
RUN apt-get update && apt-get install -y \
|
18 |
-
tzdata \
|
19 |
tar \
|
20 |
wget \
|
21 |
bash \
|
22 |
rsync \
|
23 |
gcc \
|
24 |
libfreetype6-dev \
|
25 |
-
libhdf5-dev \
|
26 |
libpng-dev \
|
27 |
libzmq3-dev \
|
28 |
python3 \
|
@@ -32,24 +25,24 @@ RUN apt-get update && apt-get install -y \
|
|
32 |
pkg-config \
|
33 |
software-properties-common \
|
34 |
graphviz \
|
35 |
-
openjdk-
|
36 |
ant \
|
37 |
ca-certificates-java \
|
38 |
&& apt-get clean \
|
39 |
&& update-ca-certificates -f
|
40 |
|
41 |
-
#
|
42 |
-
RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime && dpkg-reconfigure --frontend noninteractive tzdata
|
43 |
-
|
44 |
-
# Fix permissions for jovyan's .local directory
|
45 |
-
RUN mkdir -p /home/${NB_USER}/.local && chown -R ${NB_USER}:${NB_USER} /home/${NB_USER}/.local
|
46 |
-
|
47 |
-
# Install Python 3.11 and pip (latest stable Python as of 2024)
|
48 |
RUN add-apt-repository ppa:deadsnakes/ppa \
|
49 |
&& apt-get update \
|
50 |
-
&& apt-get install -y python3.
|
51 |
&& apt-get clean
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
# Switch to the "jovyan" user
|
54 |
USER ${NB_USER}
|
55 |
|
@@ -57,10 +50,17 @@ USER ${NB_USER}
|
|
57 |
ENV HOME=/home/${NB_USER} \
|
58 |
PATH=/home/${NB_USER}/.local/bin:$PATH
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
# Upgrade pip and install Python dependencies
|
61 |
-
RUN python3.
|
62 |
COPY requirements.txt /tmp/requirements.txt
|
63 |
-
RUN python3.
|
64 |
|
65 |
# Copy the application code into the container at /home/jovyan
|
66 |
COPY --chown=${NB_USER}:${NB_USER} . ${HOME}
|
|
|
1 |
+
# Download base image ubuntu 18.04
|
2 |
+
FROM ubuntu:18.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-8-openjdk-amd64/
|
9 |
|
10 |
+
# Install required packages
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
RUN apt-get update && apt-get install -y \
|
|
|
12 |
tar \
|
13 |
wget \
|
14 |
bash \
|
15 |
rsync \
|
16 |
gcc \
|
17 |
libfreetype6-dev \
|
18 |
+
libhdf5-serial-dev \
|
19 |
libpng-dev \
|
20 |
libzmq3-dev \
|
21 |
python3 \
|
|
|
25 |
pkg-config \
|
26 |
software-properties-common \
|
27 |
graphviz \
|
28 |
+
openjdk-8-jdk \
|
29 |
ant \
|
30 |
ca-certificates-java \
|
31 |
&& apt-get clean \
|
32 |
&& update-ca-certificates -f
|
33 |
|
34 |
+
# Install Python 3.8 and pip
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
RUN add-apt-repository ppa:deadsnakes/ppa \
|
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 |
+
# Create a new user named "jovyan" with user ID 1000
|
44 |
+
RUN useradd -m -u ${NB_UID} ${NB_USER}
|
45 |
+
|
46 |
# Switch to the "jovyan" user
|
47 |
USER ${NB_USER}
|
48 |
|
|
|
50 |
ENV HOME=/home/${NB_USER} \
|
51 |
PATH=/home/${NB_USER}/.local/bin:$PATH
|
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 the working directory to the user's home directory
|
58 |
+
WORKDIR ${HOME}
|
59 |
+
|
60 |
# Upgrade pip and install Python dependencies
|
61 |
+
RUN python3.8 -m pip install --upgrade pip
|
62 |
COPY requirements.txt /tmp/requirements.txt
|
63 |
+
RUN python3.8 -m pip install -r /tmp/requirements.txt
|
64 |
|
65 |
# Copy the application code into the container at /home/jovyan
|
66 |
COPY --chown=${NB_USER}:${NB_USER} . ${HOME}
|