# Use an older Ubuntu version that supports Python 3.4 FROM ubuntu:14.04 # Update package lists and install required dependencies RUN apt-get update && apt-get install -y \ software-properties-common \ build-essential \ libssl-dev \ zlib1g-dev \ libncurses5-dev \ libgdbm-dev \ libnss3-dev \ libreadline-dev \ libffi-dev \ wget \ curl \ && rm -rf /var/lib/apt/lists/* # Add deadsnakes PPA for Python 3.4 RUN add-apt-repository ppa:deadsnakes/ppa && apt-get update # Install Python 3.4 RUN apt-get install -y python3.4 python3.4-dev python3.4-venv # Set Python 3.4 as default (optional) RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.4 1 # Copy requirements file COPY requirements.txt /tmp/requirements.txt # Install Python dependencies RUN python3.4 -m pip install --no-cache-dir -r /tmp/requirements.txt # Create a new user RUN useradd -m -u ${NB_UID} ${NB_USER} # Switch to the new user USER ${NB_USER} # Set user-specific environment variables ENV HOME=/home/${NB_USER} ENV PATH=/home/${NB_USER}/.local/bin:$PATH # Copy application code to the container COPY --chown=${NB_USER}:${NB_USER} . ${HOME} # Expose port for Streamlit EXPOSE 7860 # Define the entry point for the container ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]