Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +17 -57
Dockerfile
CHANGED
@@ -1,75 +1,35 @@
|
|
1 |
-
#
|
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
|
11 |
-
RUN apt-
|
12 |
-
|
13 |
-
wget \
|
14 |
-
bash \
|
15 |
-
rsync \
|
16 |
-
gcc \
|
17 |
-
libfreetype6-dev \
|
18 |
-
libhdf5-serial-dev \
|
19 |
-
libpng-dev \
|
20 |
-
libzmq3-dev \
|
21 |
-
python3 \
|
22 |
-
python3-dev \
|
23 |
-
python3-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 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 |
-
# Create a new user named "jovyan" with user ID 1000
|
45 |
-
RUN useradd -m -u ${NB_UID} ${NB_USER}
|
46 |
|
47 |
-
#
|
48 |
-
USER ${NB_USER}
|
49 |
-
|
50 |
-
# Set home and path variables for the user
|
51 |
-
ENV HOME=/home/${NB_USER} \
|
52 |
-
PATH=/home/${NB_USER}/.local/bin:$PATH
|
53 |
-
|
54 |
-
# Set up PySpark to use Python 3.8 for both driver and workers
|
55 |
-
ENV PYSPARK_PYTHON=/usr/bin/python3.8
|
56 |
-
ENV PYSPARK_DRIVER_PYTHON=/usr/bin/python3.8
|
57 |
-
|
58 |
-
# Set the working directory to the user's home directory
|
59 |
-
WORKDIR ${HOME}
|
60 |
-
|
61 |
-
# Upgrade pip and install Python dependencies
|
62 |
RUN python3.8 -m pip install --upgrade pip
|
63 |
-
|
64 |
-
# Copy requirements.txt to the container and install dependencies
|
65 |
COPY requirements.txt /tmp/requirements.txt
|
66 |
RUN python3.8 -m pip install -r /tmp/requirements.txt
|
67 |
|
68 |
-
#
|
|
|
69 |
COPY streamlit.py /home/jovyan/streamlit.py
|
70 |
|
71 |
-
# Expose port
|
72 |
EXPOSE 7860
|
73 |
|
74 |
-
#
|
75 |
ENTRYPOINT ["streamlit", "run", "/home/jovyan/streamlit.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
1 |
+
# Base image
|
2 |
FROM ubuntu:18.04
|
3 |
|
4 |
+
# Install required libraries
|
5 |
+
RUN apt-get update && apt-get install -y \
|
6 |
+
tar wget bash rsync gcc libfreetype6-dev libhdf5-serial-dev libpng-dev \
|
7 |
+
libzmq3-dev python3 python3-dev python3-pip unzip pkg-config \
|
8 |
+
software-properties-common graphviz openjdk-8-jdk ant ca-certificates-java \
|
9 |
+
libgomp1 && apt-get clean
|
10 |
+
|
11 |
# Set environment variables
|
12 |
ENV NB_USER jovyan
|
13 |
ENV NB_UID 1000
|
14 |
ENV HOME /home/${NB_USER}
|
15 |
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
|
16 |
+
ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
|
17 |
|
18 |
+
# Install Python 3.8
|
19 |
+
RUN add-apt-repository ppa:deadsnakes/ppa && \
|
20 |
+
apt-get update && apt-get install -y python3.8 python3-pip && apt-get clean
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
+
# Upgrade pip and install dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
RUN python3.8 -m pip install --upgrade pip
|
|
|
|
|
24 |
COPY requirements.txt /tmp/requirements.txt
|
25 |
RUN python3.8 -m pip install -r /tmp/requirements.txt
|
26 |
|
27 |
+
# Copy application code
|
28 |
+
WORKDIR /home/jovyan
|
29 |
COPY streamlit.py /home/jovyan/streamlit.py
|
30 |
|
31 |
+
# Expose port
|
32 |
EXPOSE 7860
|
33 |
|
34 |
+
# Entry point
|
35 |
ENTRYPOINT ["streamlit", "run", "/home/jovyan/streamlit.py", "--server.port=7860", "--server.address=0.0.0.0"]
|