File size: 2,009 Bytes
6c68cf8
 
b3f566d
e05e0b8
 
 
 
6c68cf8
e05e0b8
987d8f3
 
 
83179cd
 
 
987d8f3
e052b54
d1604b4
e05e0b8
cc6a9bb
e05e0b8
 
 
 
6c68cf8
e05e0b8
 
6c68cf8
 
 
e05e0b8
 
 
 
6c68cf8
e05e0b8
 
 
 
9b1d12d
83179cd
1a5760a
 
83179cd
987d8f3
 
83179cd
 
 
 
 
0e15413
e05e0b8
 
0584773
e05e0b8
 
 
29cb98d
e05e0b8
6c68cf8
e05e0b8
6c68cf8
2ba9f9a
e05e0b8
7a77c92
b3f566d
2ba9f9a
 
 
 
83179cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Download base image ubuntu 22.04 (latest LTS as of 2024)
FROM ubuntu:22.04

# Set environment variables
ENV NB_USER jovyan
ENV NB_UID 1000
ENV HOME /home/${NB_USER}
ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64/

# Set environment variable to disable interactive prompts
ENV DEBIAN_FRONTEND=noninteractive

# Create a new user named "jovyan" with user ID 1000
RUN useradd -m -u ${NB_UID} ${NB_USER}

# Install required packages and set up timezone
RUN apt-get update && apt-get install -y \
    tzdata \
    tar \
    wget \
    bash \
    rsync \
    gcc \
    libfreetype6-dev \
    libhdf5-dev \
    libpng-dev \
    libzmq3-dev \
    python3 \
    python3-dev \
    python3-pip \
    unzip \
    pkg-config \
    software-properties-common \
    graphviz \
    openjdk-17-jdk \
    ant \
    ca-certificates-java \
    && apt-get clean \
    && update-ca-certificates -f

# Set timezone to UTC
RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime && dpkg-reconfigure --frontend noninteractive tzdata

# Fix permissions for jovyan's .local directory
RUN mkdir -p /home/${NB_USER}/.local && chown -R ${NB_USER}:${NB_USER} /home/${NB_USER}/.local

# Install Python 3.11 and pip (latest stable Python as of 2024)
RUN add-apt-repository ppa:deadsnakes/ppa \
    && apt-get update \
    && apt-get install -y python3.11 python3.11-dev python3-pip \
    && apt-get clean

# Switch to the "jovyan" user
USER ${NB_USER}

# Set home and path variables for the user
ENV HOME=/home/${NB_USER} \
    PATH=/home/${NB_USER}/.local/bin:$PATH

# Upgrade pip and install Python dependencies
RUN python3.11 -m pip install --upgrade pip
COPY requirements.txt /tmp/requirements.txt
RUN python3.11 -m pip install -r /tmp/requirements.txt

# Copy the application code into the container at /home/jovyan
COPY --chown=${NB_USER}:${NB_USER} . ${HOME}

# Expose port for Streamlit
EXPOSE 7860

# Define the entry point for the container
ENTRYPOINT ["streamlit", "run", "Demo.py", "--server.port=7860", "--server.address=0.0.0.0"]