-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathDockerfile.p2d
More file actions
95 lines (69 loc) · 3.39 KB
/
Dockerfile.p2d
File metadata and controls
95 lines (69 loc) · 3.39 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
FROM ptrxyz/chemotion:eln-3.0.0
ARG REMOTE=https://github.com/ComPlat/chemotion_ELN.git
ARG BUNDLER_VERSION=2.4.22
# The last version of bundler to support current Ruby & RubyGems was 2.4.22.
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c", "--"]
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-cache \
--mount=type=cache,target=/var/lib/apt,sharing=locked,id=apt-lib \
apt-get update -y && \
apt-get install -y --no-install-recommends --autoremove --fix-missing \
git ca-certificates curl unzip nano \
build-essential \
zlib1g-dev libreadline-dev patchelf \
cmake libpq-dev swig libmagickcore-dev \
postgresql-client inkscape imagemagick librsvg2-bin locales ghostscript \
vim iproute2 sudo make jq tmate
WORKDIR /chemotion/app
RUN cp .version /bk.version
RUN --mount=type=bind,source=.git/shallow,target=/.current_hash,readonly \
git remote add origin ${REMOTE} && \
git fetch && \
git checkout $(cat /.current_hash)
RUN mv /bk.version .version
RUN echo "For this deployed container" && \
echo "CHEMOTION_REF=$(git rev-parse --short HEAD || echo unknown)" >> /chemotion/app/.version && \
echo "CHEMOTION_TAG=$(git describe --abbrev=0 --tags || echo untagged)" >> /chemotion/app/.version
RUN rm ${ASDF_DIR}/asdf
ENV PATH="${ASDF_DIR}/bin:${PATH}"
ENV ASDF_NODEJS_VERSION=''
ENV ASDF_RUBY_VERSION=''
RUN ./prepare-asdf.sh
RUN rm -rf /asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/bundler-* && \
rm -f /asdf/installs/ruby/**/lib/ruby/gems/**/specifications/default/bundler-*.gemspec
# Ruby
RUN --mount=type=cache,target=/asdf/cache,sharing=locked \
MAKEFLAGS="-j$(nproc)" && export MAKEFLAGS && \
# asdf plugin add ruby && \
# asdf install ruby "${RUBY_VERSION}" && \
gem install bundler -v "${BUNDLER_VERSION}" && \
bundle add --skip-install 'factory_bot' && \
bundle install --jobs="$(nproc)" --retry=3 && \
bundle clean --force
RUN ./prepare-nodejs.sh
RUN asdf current && sleep 5s
RUN --mount=type=cache,target=/asdf/cache,sharing=locked \
echo -e "--modules-folder ${NODE_PATH}\n--ignore-engines" > /chemotion/app/.yarnrc && \
MAKEFLAGS="-j$(nproc)" && export MAKEFLAGS && \
npm install -g yarn && \
yarn install --modules-folder ${NODE_PATH} --ignore-engines --ignore-scripts 2>&1 | grep -v ^warning
RUN bash package_postinstall.sh
RUN MAKEFLAGS="-j$(nproc)" && export MAKEFLAGS && \
bundle install --jobs="$(nproc)" --retry=3
ADD https://payload.chemserv.scc.kit.edu/run.sh /embed/run.sh
ADD https://payload.chemserv.scc.kit.edu/health.sh /embed/health.sh
ADD https://payload.chemserv.scc.kit.edu/initialize.sh /initialize.sh
ADD https://payload.chemserv.scc.kit.edu/converter.yml /chemotion/app/config/converter.yml
ADD https://payload.chemserv.scc.kit.edu/spectra.yml /chemotion/app/config/spectra.yml
ADD https://payload.chemserv.scc.kit.edu/indigo.yml /chemotion/app/config/indigo_service.yml
ADD https://payload.chemserv.scc.kit.edu/ketcher.yml /chemotion/app/config/ketcher_service.yml
# stop check for ketcherails
RUN sed -i '/# add ketcherails templates if needed/,$d' /embed/scripts/dbcheck.sh
RUN chmod +x /embed/run.sh && \
chmod +x /embed/health.sh && \
chmod +x /initialize.sh
EXPOSE 4000
WORKDIR /chemotion/app
CMD ["/embed/run.sh"]
HEALTHCHECK --interval=30s --timeout=10s --start-period=300s --retries=3 \
CMD /embed/health.sh || exit 1
VOLUME [ "/chemotion/app", "/chemotion/data" ]