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.

114 lines
3.7 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.1" \
  10. KAL_SHLIB_CMDLINE_VERSION="0.0.5" \
  11. KAL_SHLIB_COMMON_VERSION="0.4.14" \
  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_DOCKER_VERSION="0.0.1" \
  16. KAL_SHLIB_OTHER_VERSION="0.2.2" \
  17. KAL_SHLIB_PRETTY_VERSION="0.4.3"
  18. ARG DOCKER_CLI_VERSION="17.06.2-ce"
  19. ARG DOCKER_COMPOSE_VERSION="1.21.2"
  20. ## install docker
  21. ENV DOCKER_DOWNLOAD_URL="https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_CLI_VERSION.tgz"
  22. RUN mkdir -p /tmp/docker \
  23. && curl -L "$DOCKER_DOWNLOAD_URL" | tar -xz -C /tmp/docker \
  24. && mv /tmp/docker/docker/docker /usr/local/bin/ \
  25. && rm -rf /tmp/docker
  26. ## install docker-compose
  27. # ENV DOCKER_COMPOSE_DOWNLOAD_URL="https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-Linux-x86_64"
  28. # RUN curl -L "$DOCKER_COMPOSE_DOWNLOAD_URL" > /usr/local/bin/docker-compose \
  29. # && chmod +x /usr/local/bin/docker-compose
  30. ## install kal-shlibs
  31. RUN apk --update add binutils && \
  32. mkdir /tmp/kal-shlibs && cd /tmp/kal-shlibs && \
  33. export pkg && \
  34. for pkg in core common array cache charm cmdline config firewall other pretty docker; do \
  35. echo "Installing kal-shlib-$pkg" ; \
  36. 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 ; \
  37. ar x pkg.deb || exit 1; \
  38. tar xf /tmp/kal-shlibs/data.tar.* -C / || exit 1; \
  39. rm /tmp/kal-shlibs/data.tar.* ; \
  40. done
  41. ## install shyaml
  42. RUN apk add python-dev build-base
  43. RUN apk add yaml-dev cython cython-dev && \
  44. pip install shyaml
  45. RUN pip install crudini
  46. RUN pip install docker-compose==$DOCKER_COMPOSE_VERSION
  47. RUN curl -L https://git.0k.io/0k-charm.git/plain/bin/charm > /usr/local/bin/charm && \
  48. chmod +x /usr/local/bin/charm
  49. RUN curl -L https://git.0k.io/git-sub.git/plain/bin/git-sub > /usr/local/bin/git-sub && \
  50. chmod +x /usr/local/bin/git-sub
  51. RUN curl -L https://git.0k.io/0k-docker.git/plain/src/bin/dupd > /usr/local/bin/dupd && \
  52. chmod +x /usr/local/bin/dupd
  53. RUN curl http://docker.0k.io/get/ca.0k.io.pem > /usr/local/share/ca-certificates/ca.0k.io.pem
  54. ##force install pyyaml with libyaml
  55. RUN cd /tmp && \
  56. wget https://github.com/yaml/pyyaml/archive/4.1.tar.gz && \
  57. tar xvzf 4.1.tar.gz && \
  58. cd pyyaml-4.1 && \
  59. PYTHONPATH=/usr/lib/python2.7/site-packages python setup.py --with-libyaml install
  60. FROM common
  61. COPY --from=builder /etc/shlib /etc/shlib
  62. COPY --from=builder /usr/bin/bash-shlib /usr/bin/bash-shlib
  63. COPY --from=builder /usr/lib/shlib /usr/lib/shlib
  64. COPY --from=builder /usr/local /usr/local
  65. RUN cp /usr/local/share/ca-certificates/ca.0k.io.pem /etc/ssl/ca.0k.io.pem && \
  66. apk add ca-certificates && update-ca-certificates && \
  67. mkdir -p /etc/docker/certs.d/docker.0k.io && \
  68. ln -sfn /etc/ssl/ca.0k.io.pem /etc/docker/certs.d/docker.0k.io/ca.crt
  69. ## requiring ``stdbuf`` for actions
  70. RUN apk add coreutils
  71. ## requiring ``openssl`` command for certificate generation in charms
  72. RUN apk add openssl
  73. ## requiring ``htpasswd`` command for BCrypt encryption
  74. RUN apk add apache2-utils
  75. ## required by git through ssh (for host-resources for instance)
  76. RUN apk add openssh-client
  77. ## required for acl write management (for apache data dirs for instance)
  78. RUN apk add acl
  79. ## install compose
  80. COPY ./bin/ /usr/local/bin/
  81. ENTRYPOINT ["/usr/local/bin/compose-core"]