You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.1 KiB

  1. FROM python:2-alpine3.7 as common
  2. CMD ["/bin/sh"]
  3. RUN apk --no-cache --update add git bash yaml sed lsof findutils
  4. FROM common as builder
  5. RUN apk --update add curl
  6. ## would love to use args... but I need it as an environment variable
  7. ENV KAL_SHLIB_ARRAY_VERSION="0.2.0" \
  8. KAL_SHLIB_CACHE_VERSION="0.0.1" \
  9. KAL_SHLIB_CHARM_VERSION="0.4.0" \
  10. KAL_SHLIB_CMDLINE_VERSION="0.0.4" \
  11. KAL_SHLIB_COMMON_VERSION="0.4.10" \
  12. KAL_SHLIB_CONFIG_VERSION="0.0.2" \
  13. KAL_SHLIB_CORE_VERSION="0.7.0" \
  14. KAL_SHLIB_FIREWALL_VERSION="0.2.0" \
  15. KAL_SHLIB_OTHER_VERSION="0.2.2" \
  16. KAL_SHLIB_PRETTY_VERSION="0.4.3"
  17. ARG DOCKER_CLI_VERSION="17.06.2-ce"
  18. ARG DOCKER_COMPOSE_VERSION="1.21.2"
  19. ## install docker
  20. ENV DOCKER_DOWNLOAD_URL="https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_CLI_VERSION.tgz"
  21. RUN mkdir -p /tmp/docker \
  22. && curl -L "$DOCKER_DOWNLOAD_URL" | tar -xz -C /tmp/docker \
  23. && mv /tmp/docker/docker/docker /usr/local/bin/ \
  24. && rm -rf /tmp/docker
  25. ## install docker-compose
  26. # ENV DOCKER_COMPOSE_DOWNLOAD_URL="https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-Linux-x86_64"
  27. # RUN curl -L "$DOCKER_COMPOSE_DOWNLOAD_URL" > /usr/local/bin/docker-compose \
  28. # && chmod +x /usr/local/bin/docker-compose
  29. ## install kal-shlibs
  30. RUN apk --update add binutils && \
  31. mkdir /tmp/kal-shlibs && cd /tmp/kal-shlibs && \
  32. export pkg && \
  33. for pkg in core common array cache charm cmdline config firewall other pretty; do \
  34. echo "Installing kal-shlib-$pkg" ; \
  35. 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 ; \
  36. ar x pkg.deb || exit 1; \
  37. tar xf /tmp/kal-shlibs/data.tar.* -C / || exit 1; \
  38. rm /tmp/kal-shlibs/data.tar.* ; \
  39. done
  40. ## install shyaml
  41. RUN apk add python-dev build-base
  42. RUN apk add yaml-dev cython cython-dev && \
  43. pip install shyaml
  44. RUN pip install docker-compose==$DOCKER_COMPOSE_VERSION
  45. RUN curl -L https://git.0k.io/0k-charm.git/plain/bin/charm > /usr/local/bin/charm && \
  46. chmod +x /usr/local/bin/charm
  47. RUN curl -L https://git.0k.io/git-sub.git/plain/bin/git-sub > /usr/local/bin/git-sub && \
  48. chmod +x /usr/local/bin/git-sub
  49. RUN curl http://docker.0k.io/get/ca.0k.io.pem > /usr/local/share/ca-certificates/ca.0k.io.pem
  50. ##force install pyyaml with libyaml
  51. RUN cd /tmp && \
  52. wget https://github.com/yaml/pyyaml/archive/4.1.tar.gz && \
  53. tar xvzf 4.1.tar.gz && \
  54. cd pyyaml-4.1 && \
  55. PYTHONPATH=/usr/lib/python2.7/site-packages python setup.py --with-libyaml install
  56. FROM common
  57. COPY --from=builder /etc/shlib /etc/shlib
  58. COPY --from=builder /usr/lib/shlib /usr/lib/shlib
  59. COPY --from=builder /usr/local /usr/local
  60. RUN cp /usr/local/share/ca-certificates/ca.0k.io.pem /etc/ssl/ca.0k.io.pem && \
  61. apk add ca-certificates && update-ca-certificates && \
  62. mkdir -p /etc/docker/certs.d/docker.0k.io && \
  63. ln -sfn /etc/ssl/ca.0k.io.pem /etc/docker/certs.d/docker.0k.io/ca.crt
  64. ## requiring ``stdbuf`` for actions
  65. RUN apk add coreutils
  66. ## install compose
  67. COPY ./bin/ /usr/local/bin/
  68. ENTRYPOINT ["/usr/local/bin/compose-core"]