-
Notifications
You must be signed in to change notification settings - Fork 35
/
Dockerfile
96 lines (83 loc) · 3.37 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
# Build stage with Spack pre-installed and ready to be used
FROM spack/ubuntu-bionic:latest as builder
# FROM ecpe4s/ubuntu18.04-spack-x86_64:0.15.3 as builder
ARG VERSION=develop
ARG PYTHON_VERSION=3.7
ARG COMPILER_SPEC=gcc
ARG CUDA_ARCH=70
ARG CUDA_ARCH_NAME=volta
# What we want to install and how we want to install it
# is specified in a manifest file (spack.yaml)
RUN mkdir /opt/environment \
&& (echo "spack:" \
&& echo " specs:" \
&& echo " - cuda" \
&& echo " - nccl cuda_arch=${CUDA_ARCH}" \
&& echo " - papi" \
&& echo " - mpich" \
&& echo " - gotcha" \
&& echo " - dyninst" \
&& echo " - caliper~papi" \
&& echo " - gperftools" \
&& echo " - python@${PYTHON_VERSION}" \
&& echo " - py-scikit-build" \
&& echo " - py-numpy" \
&& echo " - py-cython" \
&& echo " - py-pillow" \
&& echo " - py-ipython" \
&& echo " - py-matplotlib" \
&& echo " - py-mpi4py" \
&& echo " - py-pip" \
&& echo " - timemory@${VERSION}%${COMPILER_SPEC} +caliper+cuda+cupti+dyninst+gotcha+kokkos_tools+kokkos_build_config+mpi+mpip_library+nccl+ompt+ompt_library+papi+python+tools cuda_arch=${CUDA_ARCH_NAME}" \
&& echo " concretization: together" \
&& echo " config:" \
&& echo " install_tree: /opt/software" \
&& echo " view: /opt/view") > /opt/environment/spack.yaml
# Install the software, remove unecessary deps
RUN cd /tmp && \
apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y wget gpg software-properties-common && \
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add - && \
DISTRIB_CODENAME=$(cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F '=' '{print $NF}') && \
apt-add-repository "deb https://apt.kitware.com/ubuntu/ ${DISTRIB_CODENAME} main" && \
apt-get update && \
apt-get install -y cmake build-essential ninja-build && \
apt-get -y autoclean
# Install the software, remove unecessary deps
RUN cd /opt/environment && \
wget https://oaciss.uoregon.edu/e4s/e4s.pub && \
spack gpg trust e4s.pub && \
spack mirror add E4S https://cache.e4s.io/e4s && \
rm e4s.pub && \
spack compiler find && \
spack external find && \
spack --env . install && \
spack gc -y
# Modifications to the environment that are necessary to run
RUN cd /opt/environment && \
spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh
# Bare OS image to run the installed executables
FROM spack/ubuntu-bionic:latest
COPY --from=builder /opt/environment /opt/environment
COPY --from=builder /opt/software /opt/software
COPY --from=builder /opt/view /opt/view
COPY --from=builder /etc/profile.d/z10_spack_environment.sh /etc/profile.d/z10_spack_environment.sh
RUN echo 'export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][timemory]\[$(tput setaf 2)\] \u\[$(tput sgr0)\]:\w $ \[$(tput sgr0)\]"' >> ~/.bashrc
ENV HOME /root
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US
ENV LC_ALL C
ENV SHELL /bin/bash
ENV BASH_ENV /etc/bash.bashrc
ENV DEBIAN_FRONTEND noninteractive
COPY ./etc/profile.d/*.sh /etc/profile.d/
COPY ./etc/bash.bashrc /etc/
COPY ./etc/compute-dir-size.py /etc/
LABEL "app"="timemory"
LABEL "mpi"="mpich"
USER root
WORKDIR /home
SHELL [ "/bin/bash", "--login", "-c" ]
# ENTRYPOINT [ "/runtime-entrypoint.sh" ]
ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l"]