-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
227 lines (195 loc) · 6.28 KB
/
Dockerfile
File metadata and controls
227 lines (195 loc) · 6.28 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# ==================== BUILDER ====================
FROM ubuntu:22.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
wget \
git \
bzip2 \
&& rm -rf /var/lib/apt/lists/*
# ---------- install micromamba ----------
RUN curl -L micro.mamba.pm/install.sh -o /tmp/micromamba_install.sh \
&& printf '\n\n\n\n' | bash /tmp/micromamba_install.sh \
&& rm /tmp/micromamba_install.sh
# Install envs under /opt so copied shebangs (#!/opt/micromamba/...) match the final image layout.
RUN mkdir -p /opt/micromamba
ENV MAMBA_ROOT_PREFIX=/opt/micromamba
ENV MAMBA_EXE=/root/.local/bin/micromamba
ENV PATH="/root/.local/bin:${PATH}"
# ---------- conda environment (inline of lunus.yaml) ----------
RUN cat > /tmp/lunus.yaml <<'YAML'
name: lunus
channels:
- conda-forge
dependencies:
- python =3.10
- ambertools =24.8
- dials
- cctbx-base
- nexusformat =2.0.2
- pandas =2.2.3
- scipy =1.14.1
- numexpr =2.14.1
- joblib =1.5.3
- matplotlib =3.10.0
- ipykernel =7.2.0
- ipython =8.32.0
- jupyterlab =4.5.4
- nb_conda_kernels =2.5.1
- gtk3 =3.24.43
- xarray =2025.01.0
- nexpy =2.0.1
- scons =4.10.1
- git
- vim
- curl
- scp =0.15.0
- mdtraj =1.10.3
- openmpi <5
- mpi4py
- openssh
- cmake =3.31.2
- awscli
- gnuplot =5.4.10
YAML
RUN $MAMBA_EXE create -y -f /tmp/lunus.yaml && rm /tmp/lunus.yaml
ARG MAMBA_ENV=/opt/micromamba/envs/lunus
ENV PATH="${MAMBA_ENV}/bin:${PATH}"
ENV CONDA_PREFIX="${MAMBA_ENV}"
# ---------- pip packages ----------
RUN pip install --no-cache-dir git+https://github.com/ando-lab/mdx2.git
# ---------- GROMACS (inline of install_gromacs.sh) ----------
RUN set -ex \
&& d=$(mktemp -d) \
&& cd "$d" \
&& wget https://ftp.gromacs.org/gromacs/gromacs-2025.2.tar.gz \
&& tar xfz gromacs-2025.2.tar.gz \
&& cd gromacs-2025.2 \
&& mkdir build && cd build \
&& cmake .. \
-DGMX_BUILD_OWN_FFTW=ON \
&& make -j"$(nproc)" \
&& make install \
&& cd / \
&& rm -rf "$d"
# ---------- lunus ----------
RUN mkdir -p /root/packages \
&& cd /root/packages \
&& git clone https://github.com/lanl/lunus \
&& cd lunus \
&& scons enable-openmp=True
# ---------- cleanup: remove build-only packages + caches ----------
RUN $MAMBA_EXE remove -n lunus -y scons cmake \
&& $MAMBA_EXE clean -afy \
&& find /opt/micromamba -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null; \
find /opt/micromamba -name "*.pyc" -delete 2>/dev/null; \
rm -rf /root/packages/lunus/.git; \
true
# ==================== FINAL ====================
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
ARG CHIMERAX_URL="https://www.cgl.ucsf.edu/chimerax/cgi-bin/secure/chimerax-get.py?file=current/ubuntu-22.04/chimerax-daily.deb"
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
coreutils \
rsync \
bc \
bzip2 \
curl \
libgomp1 \
&& curl -s -c /tmp/cx_cookies -d "choice=Accept" "${CHIMERAX_URL}" \
| grep -oP 'url=\K[^"]*' > /tmp/cx_redirect \
&& curl -s -b /tmp/cx_cookies -o /tmp/chimerax.deb \
"https://www.cgl.ucsf.edu$(cat /tmp/cx_redirect)" \
&& apt-get install -y /tmp/chimerax.deb \
&& rm -f /tmp/chimerax.deb /tmp/cx_cookies /tmp/cx_redirect \
&& apt-get purge -y curl \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# ---------- bashrc (inline of bashrc_new) ----------
RUN cat > /etc/skel/.bashrc <<'BASHRC'
# If not running interactively, don't do anything
#case $- in
# *i*) ;;
# *) return;;
#esac
HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=1000
HISTFILESIZE=2000
shopt -s checkwinsize
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
eval "$(micromamba shell hook --shell bash)"
BASHRC
# ---------- copy artifacts from builder ----------
COPY --from=builder /root/.local/bin/micromamba /opt/micromamba/bin/micromamba
COPY --from=builder /opt/micromamba /opt/micromamba
COPY --from=builder /usr/local/gromacs /usr/local/gromacs
COPY --from=builder /root/packages /opt/packages
# Ship md-workflows in the lunus env so Hub users need not pip install / extend PATH.
COPY pyproject.toml /opt/md-workflows/pyproject.toml
COPY md_workflows /opt/md-workflows/md_workflows
RUN /opt/micromamba/envs/lunus/bin/python -m pip install --no-cache-dir /opt/md-workflows
ENV MAMBA_ROOT_PREFIX=/opt/micromamba
ENV MAMBA_EXE=/opt/micromamba/bin/micromamba
ENV PATH="/opt/micromamba/bin:/opt/micromamba/envs/lunus/bin:/usr/local/gromacs/bin:${PATH}"
ENV CONDA_PREFIX=/opt/micromamba/envs/lunus
ENV HOME=/home/mduser
ARG UID=1000
ARG GID=1000
RUN groupadd -g "${GID}" mduser \
&& useradd -m -u "${UID}" -g "${GID}" -s /bin/bash mduser \
&& mkdir -p /workspace \
&& chown -R mduser:mduser /home/mduser /workspace /opt/micromamba /opt/packages /opt/md-workflows
USER mduser
WORKDIR /workspace
SHELL ["/bin/bash", "-c"]
CMD ["bash"]