2018-11-04 21:34:53 +01:00
|
|
|
# Stages:
|
2018-12-06 14:21:21 +01:00
|
|
|
# root : Common image, both for the builder and for the final image.
|
2018-12-05 09:42:26 +01:00
|
|
|
# This contains only minimal dependencies required in both cases
|
2020-10-04 17:21:45 +00:00
|
|
|
# for miniconda and the Makefile.
|
2018-12-06 14:21:21 +01:00
|
|
|
# env_builder: stage in which the conda envrionment is created
|
2018-12-05 09:42:26 +01:00
|
|
|
# and dependencies are installed
|
2018-12-06 14:21:21 +01:00
|
|
|
# base : the final image containing only the required environment files,
|
2018-12-05 09:42:26 +01:00
|
|
|
# and none of the infrastructure required to generate them.
|
2018-11-04 21:34:53 +01:00
|
|
|
|
2018-12-06 14:21:21 +01:00
|
|
|
FROM registry.gitlab.com/mbarkhau/bootstrapit/env_builder AS builder
|
2018-11-04 21:34:53 +01:00
|
|
|
|
|
|
|
|
RUN mkdir /root/.ssh/ && \
|
|
|
|
|
ssh-keyscan gitlab.com >> /root/.ssh/known_hosts && \
|
|
|
|
|
ssh-keyscan registry.gitlab.com >> /root/.ssh/known_hosts
|
|
|
|
|
|
|
|
|
|
ADD requirements/ requirements/
|
|
|
|
|
ADD scripts/ scripts/
|
|
|
|
|
|
2020-10-04 17:21:45 +00:00
|
|
|
ADD Makefile.bootstrapit.make Makefile.bootstrapit.make
|
|
|
|
|
ADD Makefile Makefile
|
2018-11-04 21:34:53 +01:00
|
|
|
|
2020-08-26 21:49:01 +00:00
|
|
|
# install envs (relatively stable)
|
|
|
|
|
ADD requirements/conda.txt requirements/conda.txt
|
|
|
|
|
RUN make build/envs.txt
|
|
|
|
|
|
|
|
|
|
# install python package dependencies (change more often)
|
|
|
|
|
ADD requirements/ requirements/
|
|
|
|
|
RUN make conda
|
2018-11-04 21:34:53 +01:00
|
|
|
|
|
|
|
|
# Deleting pkgs implies that `conda install`
|
2019-02-14 23:19:18 +01:00
|
|
|
# will have to pull all packages again.
|
2018-11-04 21:34:53 +01:00
|
|
|
RUN conda clean --all --yes
|
|
|
|
|
# Conda docs say that it is not safe to delete pkgs
|
|
|
|
|
# because there may be symbolic links, so we verify
|
|
|
|
|
# first that there are no such links.
|
|
|
|
|
RUN find -L /opt/conda/envs/ -type l | grep "/opt/conda/pkgs" || exit 0
|
|
|
|
|
|
|
|
|
|
# The conda install is not usable after this RUN command. Since
|
|
|
|
|
# we only need /opt/conda/envs/ anyway, this shouldn't be an issue.
|
|
|
|
|
RUN conda clean --all --yes && \
|
|
|
|
|
ls -d /opt/conda/* | grep -v envs | xargs rm -rf && \
|
|
|
|
|
find /opt/conda/ -name "*.exe" | xargs rm -rf && \
|
|
|
|
|
find /opt/conda/ -name "__pycache__" | xargs rm -rf && \
|
|
|
|
|
rm -rf /opt/conda/pkgs/
|
|
|
|
|
|
|
|
|
|
|
2018-12-06 14:21:21 +01:00
|
|
|
FROM registry.gitlab.com/mbarkhau/bootstrapit/root
|
2018-11-04 21:34:53 +01:00
|
|
|
|
2018-12-09 15:57:04 +01:00
|
|
|
RUN apt-get install --yes mercurial;
|
|
|
|
|
|
2018-11-04 21:34:53 +01:00
|
|
|
COPY --from=builder /opt/conda/ /opt/conda/
|
|
|
|
|
COPY --from=builder /vendor/ /vendor
|