| # Start with a base image that supports Conda | |
| FROM continuumio/miniconda3 | |
| # Set up a new user named "user" with user ID 1000 | |
| RUN useradd -m -u 1000 user | |
| # Set home to the user's home directory | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| MPLCONFIGDIR=/tmp/matplotlib \ | |
| XDG_CACHE_HOME=/tmp | |
| # Set the working directory to the user's home directory | |
| WORKDIR $HOME/app | |
| # Copy everything from the repo (except DMS, since we download it separately) | |
| COPY --chown=user . $HOME/app | |
| # Switch to the "user" user | |
| USER user | |
| # Update pip within the user environment | |
| RUN pip install --no-cache-dir --upgrade pip | |
| # Install system dependencies (build-essential required for compiling DMS) | |
| USER root | |
| RUN apt-get update && apt-get install -y build-essential wget unzip && rm -rf /var/lib/apt/lists/* | |
| USER user | |
| # Create a new Conda environment and install OpenBabel directly | |
| RUN conda create -n ParaSurf python=3.10 openbabel -c conda-forge -y | |
| RUN conda run -n ParaSurf pip install --upgrade gradio | |
| # Install pip dependencies within the Conda environment | |
| RUN conda run -n ParaSurf pip install -r requirements.txt | |
| # Install gdown for downloading model weights | |
| RUN conda run -n ParaSurf pip install gdown | |
| # Set Gradio server name to bind to 0.0.0.0 for external access | |
| ENV GRADIO_SERVER_NAME="0.0.0.0" | |
| USER root | |
| WORKDIR $HOME/app/dms | |
| RUN make install | |
| USER user | |
| # RUN wget -O /home/user/.conda/envs/ParaSurf/lib/python3.10/site-packages/gradio/frpc_linux_amd64_v0.3 \ | |
| # https://cdn-media.huggingface.co/frpc-gradio-0.3/frpc_linux_amd64 && \ | |
| # chmod +x /home/user/.conda/envs/ParaSurf/lib/python3.10/site-packages/gradio/frpc_linux_amd64_v0.3 | |
| # Ensure pdb2pqr has execute permissions | |
| RUN chmod +x $HOME/app/pdb2pqr-linux-bin64-2.1.1/pdb2pqr | |
| # Return to the main application directory | |
| WORKDIR $HOME/app | |
| # Expose the port for Gradio | |
| EXPOSE 7860 | |
| # Run the app directly within the Conda environment | |
| CMD ["conda", "run", "--no-capture-output", "-n", "ParaSurf", "python", "app.py"] | |