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.

124 lines
4.2 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.5.1" \
  10. KAL_SHLIB_CMDLINE_VERSION="0.0.5" \
  11. KAL_SHLIB_COMMON_VERSION="0.4.17" \
  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.5" \
  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.24.0"
  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 apk add libffi-dev openssl-dev && \
  47. pip install pip==19.3.1 cffi==1.12.3 \
  48. git+https://github.com/0k/compose@run_ignore_orphans
  49. # docker-compose==$DOCKER_COMPOSE_VERSION
  50. # pip install git+https://github.com/vaab/colour@master
  51. RUN curl -L https://git.0k.io/0k-charm.git/plain/bin/charm > /usr/local/bin/charm && \
  52. chmod +x /usr/local/bin/charm
  53. RUN curl -L https://git.0k.io/git-sub.git/plain/bin/git-sub > /usr/local/bin/git-sub && \
  54. chmod +x /usr/local/bin/git-sub
  55. RUN curl -L https://git.0k.io/0k-docker.git/plain/src/bin/dupd > /usr/local/bin/dupd && \
  56. chmod +x /usr/local/bin/dupd
  57. RUN curl http://docker.0k.io/get/ca.0k.io.pem > /usr/local/share/ca-certificates/ca.0k.io.pem
  58. ##force install pyyaml with libyaml
  59. RUN cd /tmp && \
  60. wget https://github.com/yaml/pyyaml/archive/4.1.tar.gz && \
  61. tar xvzf 4.1.tar.gz && \
  62. cd pyyaml-4.1 && \
  63. PYTHONPATH=/usr/lib/python2.7/site-packages python setup.py --with-libyaml install
  64. FROM common
  65. COPY --from=builder /etc/shlib /etc/shlib
  66. COPY --from=builder /usr/bin/bash-shlib /usr/bin/bash-shlib
  67. COPY --from=builder /usr/lib/shlib /usr/lib/shlib
  68. COPY --from=builder /usr/local /usr/local
  69. RUN cp /usr/local/share/ca-certificates/ca.0k.io.pem /etc/ssl/ca.0k.io.pem && \
  70. apk add ca-certificates && update-ca-certificates && \
  71. mkdir -p /etc/docker/certs.d/docker.0k.io && \
  72. ln -sfn /etc/ssl/ca.0k.io.pem /etc/docker/certs.d/docker.0k.io/ca.crt
  73. ## requiring ``stdbuf`` for actions
  74. RUN apk add coreutils
  75. ## requiring ``openssl`` command for certificate generation in charms
  76. RUN apk add openssl
  77. ## requiring ``htpasswd`` command for BCrypt encryption
  78. RUN apk add apache2-utils
  79. ## requiring ``jq`` command for json querying/modifying in charms
  80. RUN apk add jq
  81. ## requiring ``getfacl/setfacl`` command for allowing to setup some permissions in charms
  82. RUN apk add acl
  83. ## required by git through ssh (for host-resources for instance)
  84. RUN apk add openssh-client
  85. ## install compose
  86. COPY ./bin/ /usr/local/bin/
  87. ## Fixes Ctrl-C handling:
  88. ## see https://github.com/moby/moby/issues/2838#issuecomment-402491110
  89. RUN apk add --no-cache tini
  90. # Tini is now available at /sbin/tini
  91. ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/compose-core"]