Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
meihuisu committed Jan 19, 2025
1 parent e8cb5c9 commit be76af6
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 21 deletions.
45 changes: 28 additions & 17 deletions ucvm_v22_7_quakeworx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ RUN useradd -ms /bin/bash -g $APP_GRPNAME --uid $APP_UID $APP_UNAME
ENV HOME=/home/$APP_UNAME

# Added steps to manage home directory permissions
RUN mkdir -p $HOME/.local \
&& chown -R $APP_UID:$APP_GID $HOME \
&& chmod -R 755 $HOME
RUN mkdir -p $HOME/.local && \
mkdir -p $HOME/result && \
chown -R $APP_UID:$APP_GID $HOME &&\
chmod -R 755 $HOME

WORKDIR /home/$APP_UNAME

Expand Down Expand Up @@ -91,21 +92,28 @@ WORKDIR /home/$APP_UNAME/app/src/largefiles
RUN ./get_largefiles.py -m $MODELID && ./stage_largefiles.py

WORKDIR /home/$APP_UNAME/app/src
RUN ./ucvm_setup.py -a -d -p /home/$APP_UNAME/app/ucvm >& ./ucvm_setup_install.log
RUN ./ucvm_setup.py -a -d -p /home/$APP_UNAME/app/ucvm >& ./ucvm_setup_install.log && \
source /home/$APP_UNAME/app/ucvm/conf/ucvm_env.sh


# Remove the src directories to save space
WORKDIR /home/$APP_UNAME/app
RUN rm -rf src

ENV PATH="/usr/local/opt/conda/bin:${PATH}"
ARG PATH="/usr/local/opt/conda/bin:${PATH}"
ENV PYTHONPATH="/home/ucvmuser/.local/lib/python3.12/site-packages/pycvm:${PYTHONPATH}"
ARG PYTHONPATH="/home/ucvmuser/.local/lib/python3.12/site-packages/pycvm:${PYTHONPATH}"
ENV PATH="/usr/local/opt/conda/bin:${HOME}/.local/bin:${PATH}"
ARG PATH="/usr/local/opt/conda/bin:${HOME}/.local/bin:${PATH}"
ENV PYTHONPATH="/usr/local/opt/conda/envs/plotPython/lib/python3.12/site-packages:${HOME}/.local/lib/python3.12/site-packages/pycvm:${PYTHONPATH}"
ARG PYTHONPATH="/usr/local/opt/conda/envs/plotPython/lib/python3.12/site-packages:${HOME}/.local/lib/python3.12/site-packages/pycvm:${PYTHONPATH}"

#import site
#print(site.getsitepackages())
#also "/usr/local/opt/conda/envs/plotPython/lib/python3.12/site-packages:${PYTHON_PATH}"


# Install plotting libraries as root
WORKDIR /home/$APP_UNAME/app
RUN git clone https://github.com/SCECcode/ucvm_plotting.git
WORKDIR /home/$APP_UNAME/app/ucvm_plotting
WORKDIR $HOME/app
RUN git clone https://github.com/SCECcode/ucvm_plotting.git -b withAnaconda3
WORKDIR $HOME/app/ucvm_plotting
RUN ./unpack-dist
## not able to unpack into system spot and so ended up at
## /home/ucvmuser/.local/lib/python3.12/site-packages/pycvm/
Expand All @@ -118,26 +126,29 @@ LABEL org.scec.responsible_person="Philip Maechling"
LABEL org.scec.primary_contact="[email protected]"
LABEL version="ucvm_v22_7"

RUN echo "source /home/$APP_UNAME/app/ucvm/conf/ucvm_env.sh" >> /home/$APP_UNAME/.bashrc && \
echo "export PATH=\"/usr/local/opt/conda/bin:$PATH\"" >> /home/$APP_UNAME/.bashrc && \
echo "conda activate plotPython" >> /home/$APP_UNAME/.bashrc
RUN echo "source $HOME/app/ucvm/conf/ucvm_env.sh" >> $HOME/.bashrc && \
echo "export PATH=\"/usr/local/opt/conda/bin:$PATH\"" >> $HOME/.bashrc && \
echo "conda activate plotPython" >> $HOME/.bashrc

RUN echo "source $HOME/app/ucvm/conf/ucvm_env.sh" > $HOME/setup && \
echo "cd $HOME/app/ucvm_plotting; ./unpack-dist" >> $HOME/setup && \
echo "cd $HOME/app/target" >> $HOME/setup

# Added steps to manage home directory permissions
RUN chown -R $APP_UID:$APP_GID $HOME && \
chmod -R 755 $HOME

USER $APP_UNAME

WORKDIR /home/$APP_UNAME
WORKDIR $HOME

# Expose the port JupyterLab will run on
EXPOSE 8888

# Define file input/output mounted disk
#VOLUME /home/$APP_UNAME/app/target

SHELL ["/bin/bash", "--login", "-c"]
CMD ["/bin/bash" ]
CMD ["/bin/bash", "--login" ]
# Define the command to run JupyterLab
#ENTRYPOINT ["/usr/local/opt/conda/bin/jupyter", "lab", "--ip=0.0.0.0", "--no-browser", "--allow-root"]

2 changes: 1 addition & 1 deletion ucvm_v22_7_quakeworx/build_one_quakeworx.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
print("pushing models: " + m + " with sceccode/ucvm_227_%s_quakeworx:%s" % (m,mdate))
cmd = "docker push sceccode/ucvm_227_%s_quakeworx:%s" % (m,mdate)
print(cmd)
os.system(cmd)
# os.system(cmd)
2 changes: 1 addition & 1 deletion ucvm_v22_7_quakeworx/target/plot_cross.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
plot_cross_section.py -s 0 -h 1176 -d vs -c cvmh -a sd -o cross_cvmh.png -i $UCVM_INSTALL_PATH -v 50 -b 33.9542,-118.7512 -u 33.9651,-117.5753 -e 5000
plot_cross_section.py -s 0 -h 1176 -d vs -c cvmh -a sd -o ../../result/cross_cvmh.png -i $UCVM_INSTALL_PATH -v 50 -b 33.9542,-118.7512 -u 33.9651,-117.5753 -e 5000

2 changes: 1 addition & 1 deletion ucvm_v22_7_quakeworx/target/plot_profile.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

plot_depth_profile.py -i $UCVM_INSTALL_PATH -d vs -c cvmh -o profile_cvmh.png -C 'CVM-H v15.1.1' -v 100 -b 0 -s 34.0625,-118.1633 -e 30000
plot_depth_profile.py -i $UCVM_INSTALL_PATH -d vs -c cvmh -o ../../result/profile_cvmh.png -C 'CVM-H v15.1.1' -v 100 -b 0 -s 34.0625,-118.1633 -e 30000

2 changes: 1 addition & 1 deletion ucvm_v22_7_quakeworx/target/plot_slice.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

plot_horizontal_slice.py -d vs -c cvmh -s 0.011 -a sd -o slice_cvmh.png -i $UCVM_INSTALL_PATH -b 33.585,-118.7904 -u 34.559,-117.5492 -e 1000
plot_horizontal_slice.py -d vs -c cvmh -s 0.011 -a sd -o ../../result/slice_cvmh.png -i $UCVM_INSTALL_PATH -b 33.585,-118.7904 -u 34.559,-117.5492 -e 1000

2 changes: 2 additions & 0 deletions ucvm_v22_7_quakeworx/target/query.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ucvm_query -m cvmh -f $UCVM_INSTALL_PATH/conf/ucvm.conf -l 34.11,-118.08,1000

6 changes: 6 additions & 0 deletions ucvm_v22_7_quakeworx/target/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source /home/ucvmuser/app/ucvm/conf/ucvm_env.sh
cd /home/ucvmuser/app/ucvm_plotting; ./unpack-dist
cd /home/ucvmuser/app/target

export PYTHONPATH="/usr/local/opt/conda/envs/plotPython/lib/python3.12/site-packages:${PYTHONPATH}"

0 comments on commit be76af6

Please sign in to comment.