Skip to content

Commit

Permalink
Merge pull request #41 from VERITAS-Observatory/container_refactor
Browse files Browse the repository at this point in the history
build(Docker-and-apptainer): updating container files
  • Loading branch information
steob92 authored May 9, 2024
2 parents 75394a9 + 2f808ff commit ba7bd0a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM jupyter/minimal-notebook AS base

# Install gammapy
RUN mamba install gcc jupyterlab --yes
RUN mamba install gcc jupyterlab "gammapy==1.2" --yes
WORKDIR /gammapy-tools


Expand All @@ -28,14 +28,17 @@ COPY --from=base /opt/conda /opt/conda
WORKDIR /gammapy-tools/tmp_build

# RUN gammapy download datasets
ENV GAMMAPY_DATA=/gammapy-tools/gammapy-datasets/1.1/
ENV GAMMAPY_DATA=/gammapy-tools/gammapy-datasets/1.2/
RUN mkdir -p $GAMMAPY_DATA
WORKDIR /gammapy-tools/
RUN gammapy download datasets

# Add package
ADD --chown=1000:100 . /gammapy-tools/tmp_build/gammapy-tools
WORKDIR /gammapy-tools/tmp_build/gammapy-tools



# RUN ls -lah
RUN pip install .
# RUN ./gammapy_tools/Hipparcos_MAG8_1997.dat $GAMMAPY_DATA/catalogs/
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ services:
- JUPYTER_TOKEN=letmein
volumes:
# Replace with where your data is located
- /path/to/data:/local_data
- $GAMMAPY_DATA:/gammapy-tools/gammapy-datasets/1.1/
- /home/obriens/DataAnalysis/Veritas/Gammapy:/local_data
# - $GAMMAPY_DATA:/gammapy-tools/gammapy-datasets/1.1/
Empty file modified docker_build.sh
100644 → 100755
Empty file.
29 changes: 17 additions & 12 deletions gammapy-tools.def
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,27 @@ Stage: build
# Port for jupyter lab
export JPORT=8000
export GAMMAPY_DATA=/gamma-tools/gammapy-datasets/1.2/
. "/opt/conda/etc/profile.d/conda.sh"
. /opt/conda/bin/activate
export PATH=/opt/conda/bin/:$PATH

#. "/opt/conda/etc/profile.d/conda.sh"
#. /opt/conda/bin/activate
#export PATH=/opt/conda/bin/:$PATH
. /opt/gammapy_tools/bin/activate


%post

apt update
apt upgrade -y
apt install curl bash git gcc btop emacs -y
apt install curl bash git gcc btop emacs python3 python3-pip python3.12-venv -y

# Install mamba and base env
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh -b -p /opt/conda
. /opt/conda/bin/activate

mamba install -c conda-forge iminuit cmasher pip papermill matplotlib pip "jupyterlab==4.0.12" notebook ipykernel ipython ipywidgets --yes
#curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
#bash Miniforge3-$(uname)-$(uname -m).sh -b -p /opt/conda
#. /opt/conda/bin/activate

python3 -m venv /opt/gammapy_tools
. /opt/gammapy_tools/bin/activate
pip install iminuit cmasher pip papermill matplotlib pip "jupyterlab==4.0.12" notebook ipykernel ipython ipywidgets
#mamba install -c conda-forge iminuit cmasher pip papermill matplotlib pip "jupyterlab==4.0.12" notebook ipykernel ipython ipywidgets --yes


# Install v2dl3
Expand All @@ -41,7 +46,7 @@ Stage: build

# Because its an env install of requirements
# Note the python version in the latest test throws issues with pytest
grep -A 100 "dependencies:" environment-eventdisplay.yml | grep "-" | grep -v "python" | awk '{print $2}' | xargs mamba install --yes
grep -A 100 "dependencies:" environment-eventdisplay.yml | grep "-" | grep -v "python" | awk '{print $2}' | xargs pip install

# root_numpy throws issues too. Only VEGAS uses it
mv setup.py _setup.py && grep -v "root_numpy" _setup.py > setup.py && pip install .
Expand All @@ -59,7 +64,7 @@ Stage: build

cd /gamma-tools ; rm -r /gamma-tools/tmp_build

mamba clean -a --yes
#mamba clean -a --yes
python -m pip cache purge


Expand Down

0 comments on commit ba7bd0a

Please sign in to comment.