-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.bartenderhaddock3
124 lines (97 loc) · 4.91 KB
/
Dockerfile.bartenderhaddock3
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
# Dockerfile for bartender web service with haddock3, lightdock, gdock executables.
FROM python:3.9-slim-bookworm AS builder
LABEL org.opencontainers.image.source=https://github.com/i-VRESSE/haddock3-webapp/blob/main/deploy/Dockerfile.bartenderhaddock3
LABEL org.opencontainers.image.licenses=Apache-2.0
LABEL org.opencontainers.image.description="bartender web service with haddock3, lightdock, gdock executables. Image does contain cns executable, which is free for non-profit users, see https://github.com/haddocking/haddock3/blob/main/DISCLAIMER.md."
ARG HADDOCK3_GHORG=haddocking
ARG HADDOCK3_VERSION=main
ARG BARTENDER_VERSION=v0.5.3
ARG GDOCK_VERSION=main
ARG LIGHTDOCK_VERSION=0.9.4
ARG OPENMM_VERSION=8.2.0beta
ARG PDBFIXER_VERSION=1.9
COPY --from=ghcr.io/ufoscout/docker-compose-wait:latest /wait /wait
# Common dependencies =================================================================================================
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential git ca-certificates curl libgfortran5 cmake swig cython3 doxygen \
wget \
&& \
apt-get clean && rm -rf /var/lib/apt/lists/* \
&& \
pip install --upgrade pip wheel
RUN python3 -m venv /venv
ENV PATH=/venv/bin:$PATH
# lightdock ==========================================================================================================
RUN echo cachebust=1 && pip install lightdock==${LIGHTDOCK_VERSION}
# gdock =============================================================================================================
# Gdock installation kaput currently, so skipping, see https://github.com/gdocking/gdock/issues/44 for details
# WORKDIR /opt/gdock
# RUN git clone --depth 1 -b ${GDOCK_VERSION} https://github.com/gdocking/gdock.git .
# RUN pip install matplotlib==3.8.4 # dont install 3.9.0rc2
# RUN python setup.py develop
# RUN bash install.sh /opt/gdock
# ENV GDOCK_PATH=/opt/gdock
# openmm =============================================================================================================
WORKDIR /opt/openmm
RUN wget https://github.com/openmm/openmm/archive/refs/tags/${OPENMM_VERSION}.tar.gz && \
tar -xzf ${OPENMM_VERSION}.tar.gz && \
cd openmm-${OPENMM_VERSION} && \
mkdir build && \
cd build && \
pip install numpy==2.* && \
cmake .. -DCMAKE_INSTALL_PREFIX=/venv && \
make -j4 && \
make install && \
make PythonInstall
RUN pip install https://github.com/openmm/pdbfixer/archive/refs/tags/${PDBFIXER_VERSION}.tar.gz
# bartender ==========================================================================================================
WORKDIR /opt/bartender
RUN echo cachebust=2 && git clone --depth 1 -b ${BARTENDER_VERSION} https://github.com/i-VRESSE/bartender.git .
RUN pip install .
# haddock3 ============================================================================================================
WORKDIR /opt/haddock3
RUN echo cachebust=15 && git clone --depth 1 -b ${HADDOCK3_VERSION} https://github.com/${HADDOCK3_GHORG}/haddock3.git .
RUN pip install .
# For restraints web service
RUN pip install fastapi uvicorn
WORKDIR /
# final image =========================================================================================================
# TODO from ghcr.io/haddocking/haddock3:2024.10.0
FROM python:3.9-slim-bookworm
# cns executable installed by haddock3 is linked against libquadmath on linux/amd64 and libgfortran5 on linux/arm64
ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
apt-get update && \
apt-get install -y libquadmath0 \
&& \
apt-get clean && rm -rf /var/lib/apt/lists/*;fi
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
apt-get update && \
apt-get install -y libgfortran5 \
&& \
apt-get clean && rm -rf /var/lib/apt/lists/*;fi
COPY --from=builder /wait /wait
COPY --from=builder /venv /venv
COPY --from=builder /opt/haddock3 /opt/haddock3
# Just copy the required files
COPY --from=builder /opt/bartender/alembic.ini /opt/bartender/alembic.ini
COPY --from=builder /opt/bartender/src/bartender/db/migrations /opt/bartender/src/bartender/db/migrations
COPY --from=builder /opt/bartender/config-example.yaml /opt/bartender/config-example.yaml
WORKDIR /opt/bartender
ENV PATH=/venv/bin:$PATH
ENV PYTHONPATH=/opt/haddock3/src
CMD ["/venv/bin/bartender", "serve"]
HEALTHCHECK --interval=30s --timeout=5s CMD curl --fail http://localhost:8000/api/health || exit 1
# non-root user ======================================================================================================
ARG USERNAME=bartender
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
RUN mkdir /jobs && chown -R $USERNAME:$USERNAME /jobs
# All commands from here on will be run as the bartender user and not as root.
USER ${USERNAME}
RUN mkdir /home/bartender/.ssh && chmod 700 /home/bartender/.ssh