@@ -45,11 +45,12 @@ RUN wget -q \
4545 && rm -f Miniforge3-Linux-x86_64.sh
4646RUN mamba --version
4747
48- # Activate and configure the mamba environment
49- RUN mamba update -n base -c conda-forge mamba && mamba info && mamba create -n streamlit-env python=3.10
50- # note: activation of mamba needs to go to bashrc because every RUN command spawns new bash
48+ # Setup mamba environment.
49+ COPY environment.yml ./environment.yml
50+ RUN mamba env create -f environment.yml
51+ RUN echo "mamba activate streamlit-env" >> ~/.bashrc
52+ SHELL ["/bin/bash", "--rcfile", "~/.bashrc"]
5153SHELL ["mamba", "run", "-n", "streamlit-env", "/bin/bash", "-c"]
52- RUN echo "source activate streamlit-env" > ~/.bashrc
5354
5455#################################### install streamlit
5556# install packages
@@ -84,8 +85,9 @@ RUN echo "0 3 * * * /root/miniforge3/envs/streamlit-env/bin/python /app/clean-up
8485
8586# create entrypoint script to start cron service and launch streamlit app
8687RUN echo "#!/bin/bash" > /app/entrypoint.sh
87- RUN echo "service cron start" >> /app/entrypoint.sh
88- RUN echo "mamba run --no-capture-output -n streamlit-env streamlit run app.py" >> /app/entrypoint.sh
88+ RUN echo "source /root/miniforge3/bin/activate streamlit-env" >> /app/entrypoint.sh && \
89+ echo "service cron start" >> /app/entrypoint.sh && \
90+ echo "streamlit run app.py" >> /app/entrypoint.sh
8991# make the script executable
9092RUN chmod +x /app/entrypoint.sh
9193
0 commit comments