Skip to content
Snippets Groups Projects
Commit 4bb1c0d1 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Use alpine image as basis.

parent e27eb55d
No related branches found
No related tags found
1 merge request!7Docker
Pipeline #37288 failed
...@@ -20,13 +20,13 @@ ...@@ -20,13 +20,13 @@
# The dockerfile is multistaged to use a fat, more convinient build image and # The dockerfile is multistaged to use a fat, more convinient build image and
# copy only necessities to a slim final image # copy only necessities to a slim final image
# We use slim for the final image FROM alpine:3.6
FROM python:3.6-slim as final RUN apk --no-cache --update-cache --virtual=.build-dependencies add g++ gfortran file binutils musl-dev python3-dev openblas-dev libstdc++ openblas make
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN python -m ensurepip
RUN ln -s /usr/bin/pip3 /usr/bin/pip
# First, build everything in a build image
FROM python:3.6-stretch as build
# Make will be necessary to build the docs with sphynx
RUN apt-get update && apt-get install -y make
RUN mkdir /install RUN mkdir /install
WORKDIR /install WORKDIR /install
# We also install the -dev dependencies, to use this image for test and qa # We also install the -dev dependencies, to use this image for test and qa
...@@ -44,26 +44,17 @@ RUN python nomad/dependencies.py ...@@ -44,26 +44,17 @@ RUN python nomad/dependencies.py
RUN ls -la .dependencies/parsers/vasp/ RUN ls -la .dependencies/parsers/vasp/
RUN ls -la .dependencies/parsers/vasp/vaspparser/ RUN ls -la .dependencies/parsers/vasp/vaspparser/
# do that after the dependencies to use docker's layer caching # do that after the dependencies to use docker's layer caching
COPY . /install COPY . /app
RUN pip install . RUN pip app .
WORKDIR /install/docs WORKDIR /app/docs
RUN make html RUN make html
RUN \ RUN \
find /usr/local/lib/python3.6/ -name 'tests' -exec rm -r '{}' + && \ find /usr/lib/python3.6/ -name 'tests' -exec rm -r '{}' + && \
find /usr/local/lib/python3.6/ -name 'test' -exec rm -r '{}' + && \ find /usr/lib/python3.6/ -name 'test' -exec rm -r '{}' + && \
find /usr/local/lib/python3.6/site-packages/ -name '*.so' -print -exec sh -c 'file "{}" | grep -q "not stripped" && strip -s "{}"' \; find /usr/lib/python3.6/site-packages/ -name '*.so' -print -exec sh -c 'file "{}" | grep -q "not stripped" && strip -s "{}"' \;
# Second, create a slim final image RUN rm /usr/include/xlocale.h && \
FROM final apk del .build-dependencies
# 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.6/site-packages /usr/local/lib/python3.6/site-packages
# 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
# copy the documentation, its files will be served by the API
COPY --from=build /install/docs/.build /app/docs/.build
RUN mkdir -p /app/.volumes/fs RUN mkdir -p /app/.volumes/fs
RUN mkdir -p /nomad RUN mkdir -p /nomad
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment