Skip to content

Commit

Permalink
updated podman instructions and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
moustakas committed Dec 12, 2024
1 parent e906312 commit 82de495
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 27 deletions.
26 changes: 10 additions & 16 deletions docker/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ubuntu:24.04
RUN mkdir -p /src
WORKDIR /src

RUN apt-get -y clean && apt -y update && apt install -y apt-utils && apt -y upgrade && echo 1
RUN apt-get -y clean && apt -y update && apt install -y apt-utils && apt -y upgrade

RUN DEBIAN_FRONTEND=noninteractive \
apt install -y --no-install-recommends \
Expand All @@ -23,11 +23,10 @@ RUN DEBIAN_FRONTEND=noninteractive \
python3.12 \
python3.12-dev \
python3-pip \
# python3-mpi4py \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# python = python3
RUN ln -s "$(which python3)" /usr/bin/python
# RUN ln -s "$(which python3)" /usr/bin/python

ARG mpich=4.1.1
ARG mpich_prefix=mpich-$mpich
Expand All @@ -43,10 +42,13 @@ RUN wget --no-check-certificate -nv https://www.mpich.org/static/downloads/$mpic
&& make install \
&& make clean \
&& cd .. \
&& rm -rf $mpich_prefix
&& rm -rf $mpich_prefix \
&& rm -f $mpich_prefix.tar.gz

RUN /sbin/ldconfig

ENV PIP_ROOT_USER_ACTION=ignore

RUN for x in \
wheel \
setuptools \
Expand All @@ -65,23 +67,22 @@ RUN for x in \
ipykernel \
h5py \
; do pip3 install --break-system-packages $x; done \
&& rm -Rf /root/.cache/pip \
&& echo 1
&& rm -Rf /root/.cache/pip

ENV DESIUTIL_VERSION 3.4.3
ENV DESIMODEL_VERSION 0.19.2
ENV DESITARGET_VERSION 2.8.0
ENV DESISPEC_VERSION 0.68.1
ENV SPECLITE_VERSION v0.20
ENV FASTSPECFIT_VERSION 3.1.0
ENV FASTSPECFIT_VERSION mpi-and-logging
#ENV FASTSPECFIT_VERSION 3.1.1

RUN pip3 install --break-system-packages git+https://github.com/desihub/desiutil.git@${DESIUTIL_VERSION}#egg=desiutil
RUN pip3 install --break-system-packages git+https://github.com/desihub/desimodel.git@${DESIMODEL_VERSION}#egg=desimodel
RUN pip3 install --break-system-packages git+https://github.com/desihub/desitarget.git@${DESITARGET_VERSION}#egg=desitarget
RUN pip3 install --break-system-packages git+https://github.com/desihub/desispec.git@${DESISPEC_VERSION}#egg=desispec
RUN pip3 install --break-system-packages git+https://github.com/desihub/speclite.git@${SPECLITE_VERSION}#egg=speclite
#RUN pip3 install --break-system-packages git+https://github.com/desihub/fastspecfit.git@${FASTSPECFIT_VERSION}#egg=fastspecfit && echo 1
RUN pip3 install --break-system-packages git+https://github.com/desihub/fastspecfit.git#egg=fastspecfit && echo 1
RUN pip3 install --break-system-packages git+https://github.com/desihub/fastspecfit.git@${FASTSPECFIT_VERSION}#egg=fastspecfit

RUN mkdir /homedir && chmod 777 /homedir
ENV HOME /homedir
Expand All @@ -94,11 +95,4 @@ SHELL ["/bin/bash", "-c"]
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["/bin/bash"]

#RUN echo "export PS1='[container] \\u@\\h:\\w$ '" >> $HOME/.bashrc \
# # Create config files in $HOME
# && python -c "import astropy" \
# && python -c "import matplotlib.font_manager as fm; f = fm.FontManager()" \
# && ipython -c "print('hello')" \
# && echo 1

LABEL Maintainer="John Moustakas [email protected]"
35 changes: 24 additions & 11 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,36 @@ Build a Docker container for fastspecfit.
Using podman-hpc at NERSC
-------------------------

podman-hpc pull ubuntu:22.04

First, build the container:
```
podman-hpc build -t desihub/fastspecfit:latest .
time podman-hpc build --tag fastspecfit:3.1.1 --file ./Containerfile ./
```
then 'migrate' the image so it can be used for jobs:
```
podman-hpc migrate fastspecfit:3.1.1
```

podman-hpc migrate desihub/fastspecfit:latest
List the available images:
```
podman-hpc images
```


```
podman-hpc login docker.io
podman-hpc push docker.io/desihub/fastspecfit:latest
podman-hpc pull docker.io/desihub/fastspecfit:latest

podman-hpc run --rm -it localhost/desihub/fastspecfit:latest /bin/bash
podman-hpc push fastspecfit:3.1.1
podman-hpc pull desihub/fastspecfit:3.1.1
```

Enter the container:
```
podman-hpc run --rm -it fastspecfit:3.1.1 /bin/bash
```

To delete a container:
```
podman-hpc rmi desihub/fastspecfit:3.1.1
```

Legacy Instructions
-------------------
Expand All @@ -41,7 +54,7 @@ Then, subsequently, to create a new (or the latest) version or tag, do:
export DOCKER_BUILDKIT=0
export COMPOSE_DOCKER_CLI_BUILD=0
docker buildx build --platform linux/amd64,linux/arm64/v8 --push -t desihub/fastspecfit:3.1.2 .
docker buildx build --platform linux/amd64,linux/arm64/v8 --push -t desihub/fastspecfit:3.1.1 .
docker buildx build --platform linux/amd64,linux/arm64/v8 --push -t desihub/fastspecfit:latest .
```

Expand All @@ -52,8 +65,8 @@ docker run -it desihub/fastspecfit:latest
```
or
```
docker pull desihub/fastspecfit:3.1.2
docker run -it desihub/fastspecfit:3.1.2
docker pull desihub/fastspecfit:3.1.1
docker run -it desihub/fastspecfit:3.1.1
```

Or at NERSC:
Expand Down

0 comments on commit 82de495

Please sign in to comment.