update docker image gen

This commit is contained in:
Manuel Barkhau 2018-12-06 14:21:21 +01:00
parent 7835c8b337
commit acfc861e58
3 changed files with 13 additions and 54 deletions

View file

@ -1,59 +1,13 @@
# Stages:
# base_image : Common base image, both for the builder and for the final image.
# root : Common image, both for the builder and for the final image.
# This contains only minimal dependencies required in both cases
# for miniconda and the makefile.
# builder : stage in which the conda envrionment is created
# env_builder: stage in which the conda envrionment is created
# and dependencies are installed
# final : the final image containing only the required environment files,
# base : the final image containing only the required environment files,
# and none of the infrastructure required to generate them.
FROM debian:stable-slim AS base_image
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV LANGUAGE en_US.UTF-8
ENV CONDA_DIR /opt/conda
ENV PATH $CONDA_DIR/bin:$PATH
ENV SHELL /bin/bash
RUN if [ $(which apk) ]; then \
apk add --no-cache bash make sed grep gawk curl git bzip2 unzip; \
elif [ $(which apt-get) ]; then \
apt-get update && apt-get install --yes bash make sed grep gawk curl git bzip2 unzip; \
else \
echo "Invalid Distro: $(uname -a)"; \
exit 1; \
fi
CMD [ "/bin/bash" ]
FROM base_image AS builder
RUN if [ $(which apk) ]; then \
apk add --no-cache ca-certificates openssh-client openssh-keygen; \
elif [ $(which apt-get) ]; then \
apt-get --yes install ca-certificates openssh-client; \
else \
echo "Invalid Distro: $(uname -a)"; \
exit 1; \
fi
ENV MINICONDA_VER latest
ENV MINICONDA Miniconda3-$MINICONDA_VER-Linux-x86_64.sh
ENV MINICONDA_URL https://repo.continuum.io/miniconda/$MINICONDA
RUN curl -L "$MINICONDA_URL" --silent -o miniconda3.sh && \
/bin/bash miniconda3.sh -f -b -p $CONDA_DIR && \
rm miniconda3.sh && \
/opt/conda/bin/conda clean -tipsy && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc && \
conda update --all --yes && \
conda config --set auto_update_conda False
# Project specific files only from here on forward
FROM registry.gitlab.com/mbarkhau/bootstrapit/env_builder AS builder
RUN mkdir /root/.ssh/ && \
ssh-keyscan gitlab.com >> /root/.ssh/known_hosts && \
@ -103,7 +57,7 @@ RUN conda clean --all --yes && \
rm -rf /opt/conda/pkgs/
FROM base_image
FROM registry.gitlab.com/mbarkhau/bootstrapit/root
COPY --from=builder /opt/conda/ /opt/conda/
COPY --from=builder /vendor/ /vendor