# Use a base image with Conda installed FROM continuumio/miniconda3:latest WORKDIR /app COPY *requirements.txt /app/ # Clone the RoLASER repository into the container RUN apt-get update && \ apt-get install -y g++ && \ apt-get install -y unzip && \ apt-get install -y git && \ git clone https://github.com/lydianish/RoLASER.git /app/RoLASER && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Clone the RoLASER repository into the container WORKDIR /app/RoLASER # Create conda environment with the required Python and GCC versions COPY environment.yml /app/RoLASER/environment.yml RUN conda env create -f environment.yml && \ echo "conda activate rolaser_env" >> ~/.bashrc ENV PATH /opt/conda/envs/rolaser_env/bin:$PATH ENV ROLASER /app/RoLASER # Install PyTorch 1.10.1 RUN pip3 install --no-cache-dir torch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu102/torch_stable.html # Install Fairseq and dependencies RUN git clone https://github.com/lydianish/fairseq.git /app/fairseq && \ cd /app/fairseq && \ git checkout rolaser && \ pip3 install --no-cache-dir --editable . && \ python3 setup.py build_ext --inplace && \ pip3 install --no-cache-dir -r /app/FAIRSEQ_requirements.txt ENV FAIRSEQ /app/fairseq # Install LASER and dependencies RUN git clone https://github.com/lydianish/LASER.git /app/LASER WORKDIR /app/LASER ENV LASER /app/LASER RUN git checkout rolaser && \ bash ./install_external_tools.sh && \ pip3 install --no-cache-dir -r /app/LASER_requirements.txt # Install other RoLASER dependencies WORKDIR /app/RoLASER RUN pip3 install --no-cache-dir -r /app/ROLASER_requirements.txt # Download models WORKDIR /app/RoLASER/models RUN wget https://zenodo.org/api/records/10864557/files-archive && \ unzip files-archive && \ mkdir $LASER/models && \ mv laser* $LASER/models && \ rm files-archive # Set Python system path to find the Fairseq and LASER modules ENV PYTHONPATH $PYTHONPATH:$FAIRSEQ ENV PYTHONPATH $PYTHONPATH:$LASER/source # Create a non-root user named "user" with user ID 1000 RUN useradd -m -u 1000 user RUN chown user:user -R /app/ # Switch to the non-root user USER user # Set home to the user's home directory ENV HOME /home/user ENV PATH $HOME/.local/bin:$PATH WORKDIR $HOME RUN mkdir app # Set the working directory to the user's home directory WORKDIR $HOME/app # Copy the current directory contents into the container at $HOME/app setting the owner to the user COPY --chown=user:user . $HOME/app EXPOSE 8501 CMD streamlit run app.py \ --server.headless true \ --server.enableCORS false \ --server.enableXsrfProtection false \ --server.fileWatcherType none