-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
111 lines (94 loc) · 4.61 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
FROM debian:bookworm
# # which spack version are we using now? Default is develop
# # but other strings can be given to the docker build command
# # (for example docker build --build-arg SPACK_VERSION=v0.16.2)
ARG SPACK_VERSION=develop
ARG OCT_VERSION=15.1
ARG BERKELEYGW_VER=""
RUN echo "Building with spack version ${SPACK_VERSION}"
# Any extra packages to be installed in the host
ARG EXTRA_PACKAGES
RUN echo "Installing EXTRA_PACKAGES ${EXTRA_PACKAGES} on container host"
# general environment for docker
ENV SPACK_ROOT=/home/user/spack \
SPACK=/home/user/spack/bin/spack \
FORCE_UNSAFE_CONFIGURE=1
RUN apt-get -y update
# Convenience tools, if desired for debugging etc
# RUN apt-get -y install wget time nano vim emacs git
# From https://github.com/ax3l/dockerfiles/blob/master/spack/base/Dockerfile:
# install minimal spack dependencies
RUN apt-get install -y --no-install-recommends \
autoconf \
build-essential \
ca-certificates \
coreutils \
curl \
environment-modules \
file \
gfortran \
git \
openssh-server \
python3 \
unzip \
vim \
&& rm -rf /var/lib/apt/lists/*
# load spack environment on login
RUN echo "source $SPACK_ROOT/share/spack/setup-env.sh" \
> /etc/profile.d/spack.sh
RUN adduser user
USER user
WORKDIR /home/user
# install spack
RUN git clone https://github.com/spack/spack.git
# default branch is develop
RUN cd spack && git checkout $SPACK_VERSION
# # show which version we use
RUN $SPACK --version
# copy our package.py into the spack tree (and also example files)
COPY spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/octopus/package.py
RUN ls -l $SPACK_ROOT/var/spack/repos/builtin/packages/octopus
COPY spack/test/ $SPACK_ROOT/var/spack/repos/builtin/packages/octopus/test
RUN ls -l $SPACK_ROOT/var/spack/repos/builtin/packages/octopus/test
# Install and test serial and MPI versions of ocoptus via spack
# # serial version
RUN . $SPACK_ROOT/share/spack/setup-env.sh && \
# create a new environment for the serial version and activate it:
spack env create octopus-serial && \
spack env activate octopus-serial && \
# display specs of upcoming spack installation:
# we use the [email protected] as newer versions are not downloadable at the moment
# see https://github.com/spack/spack/issues/43122
# TODO: remove the version number when the issue is resolved
spack spec octopus@${OCT_VERSION} ~mpi+netcdf+arpack+cgal+python+likwid+libyaml+elpa+nlopt+etsf-io+sparskit+berkeleygw+nfft~debug~cuda~metis ^berkeleygw${BERKELEYGW_VER} && \
# run the spack installation (adding it to the environment):
spack add octopus@${OCT_VERSION} ~mpi+netcdf+arpack+cgal+python+likwid+libyaml+elpa+nlopt+etsf-io+sparskit+berkeleygw+nfft~debug~cuda~metis ^berkeleygw${BERKELEYGW_VER} && \
spack install && \
# run spack smoke tests for octopus. We get an error if any of the fails:
spack test run --alias test_serial octopus && \
# display output from smoke tests (just for information):
spack test results -l test_serial && \
# show which octopus version we use (for convenience):
spack load octopus && octopus --version && \
# deactivate the environment.
spack env deactivate
# # MPI version
RUN . $SPACK_ROOT/share/spack/setup-env.sh && \
# create a new environment for the MPI version and activate it:
spack env create octopus-mpi && \
spack env activate octopus-mpi && \
# display specs of upcoming spack installation:
spack spec octopus@${OCT_VERSION} +mpi +netcdf+parmetis+arpack+cgal+pfft+pnfft+python+likwid+libyaml+elpa+nlopt+etsf-io+sparskit+berkeleygw+nfft~debug~cuda~metis~scalapack ^berkeleygw${BERKELEYGW_VER} && \
# run the spack installation (adding it to the environment):
spack add octopus@${OCT_VERSION} +mpi +netcdf+parmetis+arpack+cgal+pfft+pnfft+python+likwid+libyaml+elpa+nlopt+etsf-io+sparskit+berkeleygw+nfft~debug~cuda~metis~scalapack ^berkeleygw${BERKELEYGW_VER} && \
spack install && \
# run spack smoke tests for octopus. We get an error if any of the fails:
spack test run --alias test_MPI octopus && \
# display output from smoke tests (just for information):
spack test results -l test_MPI && \
# show which octopus version we use (for convenience):
spack load octopus && octopus --version && \
# deactivate the environment.
spack env deactivate
# Provide bash in case the image is meant to be used interactively
CMD /bin/bash -l