Spaces:
Sleeping
Sleeping
| # 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 | |
| # Install pip for Python 3.4 | |
| RUN curl https://bootstrap.pypa.io/pip/3.4/get-pip.py -o get-pip.py && \ | |
| python3.4 get-pip.py && \ | |
| rm get-pip.py | |
| # Verify Python and pip versions | |
| RUN python3.4 --version && python3.4 -m pip --version | |
| # Copy requirements file (if applicable) | |
| 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"] | |