Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +15 -25
Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
#
|
2 |
FROM ubuntu:18.04
|
3 |
|
4 |
# Set environment variables
|
@@ -6,10 +6,8 @@ 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 |
-
ENV PYSPARK_PYTHON=/usr/bin/python3.8
|
10 |
-
ENV PYSPARK_DRIVER_PYTHON=/usr/bin/python3.8
|
11 |
|
12 |
-
# Install required packages
|
13 |
RUN apt-get update && apt-get install -y \
|
14 |
tar \
|
15 |
wget \
|
@@ -30,8 +28,6 @@ RUN apt-get update && apt-get install -y \
|
|
30 |
openjdk-8-jdk \
|
31 |
ant \
|
32 |
ca-certificates-java \
|
33 |
-
curl \
|
34 |
-
git \
|
35 |
&& apt-get clean \
|
36 |
&& update-ca-certificates -f
|
37 |
|
@@ -44,7 +40,6 @@ RUN add-apt-repository ppa:deadsnakes/ppa \
|
|
44 |
# Set up JAVA_HOME
|
45 |
RUN echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/" >> /etc/profile \
|
46 |
&& echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/profile
|
47 |
-
|
48 |
# Create a new user named "jovyan" with user ID 1000
|
49 |
RUN useradd -m -u ${NB_UID} ${NB_USER}
|
50 |
|
@@ -55,28 +50,23 @@ USER ${NB_USER}
|
|
55 |
ENV HOME=/home/${NB_USER} \
|
56 |
PATH=/home/${NB_USER}/.local/bin:$PATH
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
# Upgrade pip and install Python dependencies
|
59 |
RUN python3.8 -m pip install --upgrade pip
|
60 |
-
|
61 |
-
# Copy the Python requirements file and install dependencies
|
62 |
COPY requirements.txt /tmp/requirements.txt
|
63 |
RUN python3.8 -m pip install -r /tmp/requirements.txt
|
64 |
|
65 |
-
#
|
66 |
-
USER root
|
67 |
-
RUN curl -fsSL https://ollama.com/download.sh | bash
|
68 |
-
|
69 |
-
# Switch back to the "jovyan" user
|
70 |
-
USER ${NB_USER}
|
71 |
-
|
72 |
-
# Set working directory to the user's home directory
|
73 |
-
WORKDIR ${HOME}
|
74 |
-
|
75 |
-
# Expose ports for Streamlit and Ollama
|
76 |
-
EXPOSE 7860 11434
|
77 |
-
|
78 |
-
# Copy application code into the container
|
79 |
COPY --chown=${NB_USER}:${NB_USER} . ${HOME}
|
80 |
|
81 |
-
#
|
82 |
-
|
|
|
|
|
|
|
|
1 |
+
# Download base image ubuntu 18.04
|
2 |
FROM ubuntu:18.04
|
3 |
|
4 |
# Set environment variables
|
|
|
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 \
|
|
|
28 |
openjdk-8-jdk \
|
29 |
ant \
|
30 |
ca-certificates-java \
|
|
|
|
|
31 |
&& apt-get clean \
|
32 |
&& update-ca-certificates -f
|
33 |
|
|
|
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 |
|
|
|
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}
|
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"]
|