FROM python:2-alpine3.7 as common CMD ["/bin/sh"] RUN apk --no-cache --update add git bash yaml sed lsof findutils FROM common as builder RUN apk --update add curl ## would love to use args... but I need it as an environment variable ENV KAL_SHLIB_ARRAY_VERSION="0.2.0" \ KAL_SHLIB_CACHE_VERSION="0.0.1" \ KAL_SHLIB_CHARM_VERSION="0.4.0" \ KAL_SHLIB_CMDLINE_VERSION="0.0.4" \ KAL_SHLIB_COMMON_VERSION="0.4.10" \ KAL_SHLIB_CONFIG_VERSION="0.0.2" \ KAL_SHLIB_CORE_VERSION="0.7.0" \ KAL_SHLIB_FIREWALL_VERSION="0.2.0" \ KAL_SHLIB_OTHER_VERSION="0.2.2" \ KAL_SHLIB_PRETTY_VERSION="0.4.3" ARG DOCKER_CLI_VERSION="17.06.2-ce" ARG DOCKER_COMPOSE_VERSION="1.21.2" ## install docker ENV DOCKER_DOWNLOAD_URL="https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_CLI_VERSION.tgz" RUN mkdir -p /tmp/docker \ && curl -L "$DOCKER_DOWNLOAD_URL" | tar -xz -C /tmp/docker \ && mv /tmp/docker/docker/docker /usr/local/bin/ \ && rm -rf /tmp/docker ## install docker-compose # ENV DOCKER_COMPOSE_DOWNLOAD_URL="https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-Linux-x86_64" # RUN curl -L "$DOCKER_COMPOSE_DOWNLOAD_URL" > /usr/local/bin/docker-compose \ # && chmod +x /usr/local/bin/docker-compose ## install kal-shlibs RUN apk --update add binutils && \ mkdir /tmp/kal-shlibs && cd /tmp/kal-shlibs && \ export pkg && \ for pkg in core common array cache charm cmdline config firewall other pretty; do \ echo "Installing kal-shlib-$pkg" ; \ bash -c -- 'eval curl -L http://deb.kalysto.org/pool/no-dist/kal-alpha/kal-shlib-${pkg}_\${KAL_SHLIB_${pkg^^}_VERSION}-1_all.deb' > pkg.deb || exit 1 ; \ ar x pkg.deb || exit 1; \ tar xf /tmp/kal-shlibs/data.tar.* -C / || exit 1; \ rm /tmp/kal-shlibs/data.tar.* ; \ done ## install shyaml RUN apk add python-dev build-base RUN apk add yaml-dev cython cython-dev && \ pip install shyaml RUN pip install docker-compose==$DOCKER_COMPOSE_VERSION RUN curl -L https://git.0k.io/0k-charm.git/plain/bin/charm > /usr/local/bin/charm && \ chmod +x /usr/local/bin/charm RUN curl -L https://git.0k.io/git-sub.git/plain/bin/git-sub > /usr/local/bin/git-sub && \ chmod +x /usr/local/bin/git-sub RUN curl http://docker.0k.io/get/ca.0k.io.pem > /usr/local/share/ca-certificates/ca.0k.io.pem ##force install pyyaml with libyaml RUN cd /tmp && \ wget https://github.com/yaml/pyyaml/archive/4.1.tar.gz && \ tar xvzf 4.1.tar.gz && \ cd pyyaml-4.1 && \ PYTHONPATH=/usr/lib/python2.7/site-packages python setup.py --with-libyaml install FROM common COPY --from=builder /etc/shlib /etc/shlib COPY --from=builder /usr/lib/shlib /usr/lib/shlib COPY --from=builder /usr/local /usr/local RUN cp /usr/local/share/ca-certificates/ca.0k.io.pem /etc/ssl/ca.0k.io.pem && \ apk add ca-certificates && update-ca-certificates && \ mkdir -p /etc/docker/certs.d/docker.0k.io && \ ln -sfn /etc/ssl/ca.0k.io.pem /etc/docker/certs.d/docker.0k.io/ca.crt ## requiring ``stdbuf`` for actions RUN apk add coreutils ## install compose COPY ./bin/ /usr/local/bin/ ENTRYPOINT ["/usr/local/bin/compose-core"]