Skip to content

Commit a85c080

Browse files
committed
call spack clean after install to reduce image size
feelpp/feelpp#2016 [ci skip]
1 parent d8df86f commit a85c080

File tree

1 file changed

+69
-23
lines changed

1 file changed

+69
-23
lines changed

feelpp-env/Dockerfile-spack-mpich

Lines changed: 69 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,94 @@ RUN apt-get update && apt-get install -y \
88
python3-setuptools \
99
rsync \
1010
libblas-dev \
11-
liblapack-dev
11+
liblapack-dev
1212

1313
# Install Clang via Spack
14-
RUN spack install llvm
14+
RUN spack install -j40 llvm \
15+
&& spack clean -a
1516

1617
# Install MPICH via Spack
17-
RUN spack install -j40 mpich
18+
RUN spack install -j40 mpich \
19+
&& spack clean -a
1820

1921
# Install HDF5 and MUMPS via Spack using MPICH
2022
RUN spack install -j40 hdf5 +mpi ^mpich \
21-
&& spack install -j40 mumps +scotch ~metis +mpi ^mpich
23+
&& spack install -j40 mumps +scotch ~metis +mpi ^mpich \
24+
&& spack clean -a
2225

2326
# Install Gmsh via Spack
24-
RUN spack install -j40 gmsh +oce +hdf5 ^/$(spack find --format "{hash:7}" hdf5)
27+
RUN spack install -j40 gmsh +oce +hdf5 ^/$(spack find --format "{hash:7}" hdf5)\
28+
&& spack clean -a
2529

2630
# Install Boost with MPI support, using MPICH
27-
RUN spack install -j40 boost +date_time+filesystem+iostreams+mpi+multithreaded+program_options+serialization+shared+system+test ^mpich && spack load boost
31+
RUN spack install -j40 boost +date_time+filesystem+iostreams+mpi+multithreaded+program_options+serialization+shared+system+test ^mpich && spack load boost \
32+
&& spack clean -a
2833

2934
# Install PETSc with MPI support
30-
RUN spack install -j40 petsc +mumps ^/$(spack find --format "{hash:7}" mumps) +mpi ^mpich && spack load petsc
35+
RUN spack install -j40 petsc +mumps ^/$(spack find --format "{hash:7}" mumps) +mpi ^mpich && spack load petsc \
36+
&& spack clean -a
3137

3238
# Install SLEPc
33-
RUN spack install -j40 slepc ^/$(spack find --format "{hash:7}" petsc) && spack load slepc
39+
RUN spack install -j40 slepc ^/$(spack find --format "{hash:7}" petsc) && spack load slepc \
40+
&& spack clean -a
3441

3542
# Install Python packages via Spack
36-
RUN spack install -j40 python && spack load python
43+
RUN spack install -j40 python && spack load python \
44+
&& spack clean -a
3745

38-
RUN spack install -j40 py-mpi4py ^mpich
39-
RUN spack install -j40 py-petsc4py ^/$(spack find --format "{hash:7}" petsc)
40-
RUN spack install -j40 py-slepc4py ^/$(spack find --format "{hash:7}" slepc)
46+
RUN spack install -j40 py-mpi4py ^mpich\
47+
&& spack clean -a
48+
RUN spack install -j40 py-petsc4py ^/$(spack find --format "{hash:7}" petsc)\
49+
&& spack clean -a
50+
RUN spack install -j40 py-slepc4py ^/$(spack find --format "{hash:7}" slepc)\
51+
&& spack clean -a
4152
RUN spack load py-mpi4py py-petsc4py py-slepc4py
4253

43-
RUN spack install -j40 py-pybind11 \
44-
&& spack install -j40 py-sympy \
45-
&& spack install -j40 py-pytest \
46-
&& spack install -j40 py-plotly \
47-
&& spack install -j40 py-scikit-learn \
48-
&& spack install -j40 py-pandas \
49-
&& spack install -j40 py-tqdm \
50-
&& spack install -j40 py-h5py \
51-
&& spack install -j40 py-numpy \
52-
&& spack load py-pybind11 py-sympy py-pytest py-plotly py-scikit-learn py-pandas py-tqdm py-h5py py-numpy
54+
RUN spack install -j10 py-sympy\
55+
&& spack clean -a
56+
RUN spack install -j10 py-pytest\
57+
&& spack clean -a
58+
#RUN spack install -j40 py-plotly
59+
#RUN spack install -j40 py-scikit-learn
60+
RUN spack install -j10 py-pandas\
61+
&& spack clean -a
62+
RUN spack install -j10 py-tqdm\
63+
&& spack clean -a
64+
RUN spack install -j10 py-h5py\
65+
&& spack clean -a
66+
RUN spack install -j10 py-numpy\
67+
&& spack clean -a
68+
RUN spack load py-sympy py-pytest py-pandas py-tqdm py-h5py py-numpy/wlkev44
69+
70+
RUN spack install -j10 libzip && spack load libzip\
71+
&& spack clean -a
72+
RUN spack install -j10 cmake && spack load cmake\
73+
&& spack clean -a
74+
RUN spack install -j10 ninja && spack load ninja\
75+
&& spack clean -a
76+
RUN spack install -j10 git && spack load git\
77+
&& spack clean -a
78+
RUN spack install -j10 curl && spack load curl\
79+
&& spack clean -a
80+
RUN spack install -j10 wget && spack load wget\
81+
&& spack clean -a
82+
RUN spack install -j10 rsync && spack load rsync\
83+
&& spack clean -a
84+
85+
RUN useradd -m devuser
86+
# Set password for devuser (you may want to use a more secure method for setting the password)
87+
RUN echo "devuser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
88+
89+
# Set the user to 'devuser'
90+
USER devuser
91+
92+
# Set the working directory to the user's home directory
93+
WORKDIR /home/devuser
94+
95+
# Install Bash-it
96+
RUN git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it \
97+
&& ~/.bash_it/install.sh \
98+
&& echo "source /opt/spack/share/spack/bash/spack-completion.bash" >> ~/.bashrc
5399

54100
# Set the default command to launch when starting the container
55-
CMD ["/bin/bash"]
101+
#CMD ["/bin/bash"]

0 commit comments

Comments
 (0)