abdullahmubeen10 commited on
Commit
83179cd
·
verified ·
1 Parent(s): 987d8f3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -22
Dockerfile CHANGED
@@ -1,9 +1,6 @@
1
  # Download base image ubuntu 22.04 (latest LTS as of 2024)
2
  FROM ubuntu:22.04
3
 
4
- # Set environment variable to disable interactive prompts
5
- ENV DEBIAN_FRONTEND=noninteractive
6
-
7
  # Set environment variables
8
  ENV NB_USER jovyan
9
  ENV NB_UID 1000
@@ -13,6 +10,9 @@ ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64/
13
  # Set environment variable to disable interactive prompts
14
  ENV DEBIAN_FRONTEND=noninteractive
15
 
 
 
 
16
  # Install required packages and set up timezone
17
  RUN apt-get update && apt-get install -y \
18
  tzdata \
@@ -38,21 +38,17 @@ RUN apt-get update && apt-get install -y \
38
  && apt-get clean \
39
  && update-ca-certificates -f
40
 
41
- # Set timezone to a specific value (e.g., UTC)
42
  RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime && dpkg-reconfigure --frontend noninteractive tzdata
43
 
44
- # Fix permissions on the .local directory to ensure pip can write
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 upgrade pip
48
- RUN python3.11 -m pip install --upgrade pip
49
-
50
- # Set up JAVA_HOME
51
- RUN echo "export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/" >> /etc/profile \
52
- && echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/profile
53
-
54
- # Create a new user named "jovyan" with user ID 1000
55
- RUN useradd -m -u ${NB_UID} ${NB_USER}
56
 
57
  # Switch to the "jovyan" user
58
  USER ${NB_USER}
@@ -61,13 +57,6 @@ USER ${NB_USER}
61
  ENV HOME=/home/${NB_USER} \
62
  PATH=/home/${NB_USER}/.local/bin:$PATH
63
 
64
- # Set up PySpark to use Python 3.11 for both driver and workers
65
- ENV PYSPARK_PYTHON=/usr/bin/python3.11
66
- ENV PYSPARK_DRIVER_PYTHON=/usr/bin/python3.11
67
-
68
- # Set the working directory to the user's home directory
69
- WORKDIR ${HOME}
70
-
71
  # Upgrade pip and install Python dependencies
72
  RUN python3.11 -m pip install --upgrade pip
73
  COPY requirements.txt /tmp/requirements.txt
@@ -80,4 +69,4 @@ COPY --chown=${NB_USER}:${NB_USER} . ${HOME}
80
  EXPOSE 7860
81
 
82
  # Define the entry point for the container
83
- ENTRYPOINT ["streamlit", "run", "Demo.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
1
  # Download base image ubuntu 22.04 (latest LTS as of 2024)
2
  FROM ubuntu:22.04
3
 
 
 
 
4
  # Set environment variables
5
  ENV NB_USER jovyan
6
  ENV NB_UID 1000
 
10
  # Set environment variable to disable interactive prompts
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 \
 
38
  && apt-get clean \
39
  && update-ca-certificates -f
40
 
41
+ # Set timezone to UTC
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.11 python3.11-dev python3-pip \
51
+ && apt-get clean
 
 
 
 
52
 
53
  # Switch to the "jovyan" user
54
  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.11 -m pip install --upgrade pip
62
  COPY requirements.txt /tmp/requirements.txt
 
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"]