abdullahmubeen10 commited on
Commit
e05e0b8
·
verified ·
1 Parent(s): ad7b32e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +55 -39
Dockerfile CHANGED
@@ -1,56 +1,72 @@
1
- # Use an older Ubuntu version that supports Python 3.4
2
- FROM ubuntu:14.04
3
 
4
- # Update package lists and install required dependencies
 
 
 
 
 
 
5
  RUN apt-get update && apt-get install -y \
6
- software-properties-common \
7
- build-essential \
8
- libssl-dev \
9
- zlib1g-dev \
10
- libncurses5-dev \
11
- libgdbm-dev \
12
- libnss3-dev \
13
- libreadline-dev \
14
- libffi-dev \
15
  wget \
16
- curl \
17
- && rm -rf /var/lib/apt/lists/*
18
-
19
- # Add deadsnakes PPA for Python 3.4
20
- RUN add-apt-repository ppa:deadsnakes/ppa && apt-get update
21
-
22
- # Install Python 3.4
23
- RUN apt-get install -y python3.4 python3.4-dev python3.4-venv
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- # Install pip for Python 3.4
26
- RUN curl https://bootstrap.pypa.io/pip/3.4/get-pip.py -o get-pip.py && \
27
- python3.4 get-pip.py && \
28
- rm get-pip.py
 
29
 
30
- # Verify Python and pip versions
31
- RUN python3.4 --version && python3.4 -m pip --version
 
 
 
32
 
33
- # Copy requirements file (if applicable)
34
- COPY requirements.txt /tmp/requirements.txt
35
 
36
- # Install Python dependencies
37
- RUN python3.4 -m pip install --no-cache-dir -r /tmp/requirements.txt
 
38
 
39
- # Create a new user
40
- RUN useradd -m -u ${NB_UID} ${NB_USER}
 
41
 
42
- # Switch to the new user
43
- USER ${NB_USER}
44
 
45
- # Set user-specific environment variables
46
- ENV HOME=/home/${NB_USER}
47
- ENV PATH=/home/${NB_USER}/.local/bin:$PATH
 
48
 
49
- # Copy application code to the container
50
  COPY --chown=${NB_USER}:${NB_USER} . ${HOME}
51
 
52
  # Expose port for Streamlit
53
  EXPOSE 7860
54
 
55
  # Define the entry point for the container
56
- ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
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-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
+ python \
22
+ python-dev \
23
+ python-pip \
24
+ unzip \
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 python 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
 
49
+ # Set home and path variables for the user
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/python
55
+ ENV PYSPARK_DRIVER_PYTHON=/usr/bin/python
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 python -m pip install --upgrade pip
62
+ COPY requirements.txt /tmp/requirements.txt
63
+ RUN python -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}
67
 
68
  # Expose port for Streamlit
69
  EXPOSE 7860
70
 
71
  # Define the entry point for the container
72
+ ENTRYPOINT ["streamlit", "run", "Demo.py", "--server.port=7860", "--server.address=0.0.0.0"]