Commit d6a3328a authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fix build in Dockerfile.

parent 95615c3b
Pipeline #76333 passed with stages
in 32 minutes and 43 seconds
......@@ -19,10 +19,8 @@
# The dockerfile is multistaged to use a fat, more convinient build image and
# copy only necessities to a slim final image
# We use stretch instead of slim to allow compoilation of some dependencies. We
# do not bother to have an additional copy to a final slim image, because the space
# savings are minimal
FROM python:3.7-stretch as final
# We use slim for the final image
FROM python:3.7-slim as final
# First built the GUI in a gui build image
FROM node:latest as gui_build
......@@ -34,10 +32,11 @@ COPY gui/yarn.lock /app/yarn.lock
RUN yarn
COPY gui /app
RUN yarn run build
# RUN yarn run --silent react-docgen src/components --pretty > react-docgen.out
# Second, build all python stuff in a python build image
FROM final
RUN mkdir /app
FROM python:3.7-stretch as build
RUN mkdir /install
# Install linux package dependencies
RUN apt-get update
......@@ -63,6 +62,10 @@ RUN pip install matid
RUN pip install mdtraj
RUN pip install mdanalysis
# Make will be necessary to build the docs with sphynx
RUN apt-get update && apt-get install -y make
RUN apt-get update && apt-get install -y vim
# Install pymolfile (required by some parsers)
RUN git clone -b nomad-fair https://gitlab.mpcdf.mpg.de/nomad-lab/pymolfile.git
WORKDIR /pymolfile/
......@@ -70,24 +73,48 @@ RUN python3 setup.py install
RUN rm -rf /pymolfile
# Copy files and install nomad@FAIRDI
WORKDIR /app
COPY . /app
WORKDIR /install
COPY . /install
RUN python setup.py compile
RUN pip install .[all]
RUN python setup.py sdist
RUN cp dist/nomad-lab-*.tar.gz dist/nomad-lab.tar.gz
WORKDIR /app/docs
WORKDIR /install/docs
# COPY --from=gui_build /app/react-docgen.out /install/docs
RUN make html
# Remove unnessesary files
WORKDIR /app
RUN \
find /usr/local/lib/python3.7/ -name 'tests' ! -path '*/networkx/*' -exec rm -r '{}' + && \
find /usr/local/lib/python3.7/ -name 'test' -exec rm -r '{}' + && \
find /usr/local/lib/python3.7/site-packages/ -name '*.so' -print -exec sh -c 'file "{}" | grep -q "not stripped" && strip -s "{}"' \;
# Setup directories, users, rights
# Third, create a slim final image
FROM final
RUN apt-get update && apt-get install -y --no-install-recommends libgomp1 && apt-get install -y libmagic-dev curl
# copy the sources for tests, coverage, qa, etc.
COPY . /app
WORKDIR /app
# transfer installed packages from dependency stage
COPY --from=build /usr/local/lib/python3.7/site-packages /usr/local/lib/python3.7/site-packages
RUN echo "copy 1"
# copy the meta-info, since it files are loaded via relative paths. TODO that should change.
COPY --from=build /install/dependencies/nomad-meta-info /app/dependencies/nomad-meta-info
RUN echo "copy 2"
# copy the documentation, its files will be served by the API
COPY --from=build /install/docs/.build /app/docs/.build
RUN echo "copy 3"
# copy the source distribution, its files will be served by the API
COPY --from=build /install/dist /app/dist
RUN echo "copy 4"
# copy the nomad command
COPY --from=build /usr/local/bin/nomad /usr/bin/nomad
RUN echo "copy 5"
# copy the gui
RUN mkdir -p /app/gui
COPY --from=gui_build /app/build /app/gui/build
RUN echo "copy 6"
RUN mkdir -p /app/.volumes/fs
RUN useradd -ms /bin/bash nomad
RUN chown -R nomad /app
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment