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.

144 lines
5.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. RUN apk --no-cache --update add libxslt
  5. FROM common as builder
  6. RUN apk --update add curl
  7. ## would love to use args... but I need it as an environment variable
  8. ENV KAL_SHLIB_ARRAY_VERSION="0.2.0" \
  9. KAL_SHLIB_CACHE_VERSION="0.0.1" \
  10. KAL_SHLIB_CHARM_VERSION="0.5.1" \
  11. KAL_SHLIB_CMDLINE_VERSION="0.0.5" \
  12. KAL_SHLIB_COMMON_VERSION="0.4.17" \
  13. KAL_SHLIB_CONFIG_VERSION="0.0.2" \
  14. KAL_SHLIB_CORE_VERSION="0.7.0" \
  15. KAL_SHLIB_FIREWALL_VERSION="0.2.0" \
  16. KAL_SHLIB_DOCKER_VERSION="0.0.6" \
  17. KAL_SHLIB_OTHER_VERSION="0.2.2" \
  18. KAL_SHLIB_PRETTY_VERSION="0.4.3"
  19. ARG DOCKER_CLI_VERSION="17.06.2-ce"
  20. ARG DOCKER_COMPOSE_VERSION="1.24.0"
  21. ## install docker
  22. ENV DOCKER_DOWNLOAD_URL="https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_CLI_VERSION.tgz"
  23. RUN mkdir -p /tmp/docker \
  24. && curl -L "$DOCKER_DOWNLOAD_URL" | tar -xz -C /tmp/docker \
  25. && mv /tmp/docker/docker/docker /usr/local/bin/ \
  26. && rm -rf /tmp/docker
  27. ## install docker-compose
  28. # ENV DOCKER_COMPOSE_DOWNLOAD_URL="https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-Linux-x86_64"
  29. # RUN curl -L "$DOCKER_COMPOSE_DOWNLOAD_URL" > /usr/local/bin/docker-compose \
  30. # && chmod +x /usr/local/bin/docker-compose
  31. ## install kal-shlibs
  32. RUN apk --update add binutils && \
  33. mkdir /tmp/kal-shlibs && cd /tmp/kal-shlibs && \
  34. export pkg && \
  35. for pkg in core common array cache charm cmdline config firewall other pretty docker; do \
  36. echo "Installing kal-shlib-$pkg" ; \
  37. 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 ; \
  38. ar x pkg.deb || exit 1; \
  39. tar xf /tmp/kal-shlibs/data.tar.* -C / || exit 1; \
  40. rm /tmp/kal-shlibs/data.tar.* ; \
  41. done
  42. ## install shyaml
  43. RUN apk add python-dev build-base
  44. RUN apk add yaml-dev cython cython-dev && \
  45. pip install shyaml
  46. RUN pip install crudini
  47. RUN apk add libffi-dev openssl-dev && \
  48. pip install pip==19.3.1 cffi==1.12.3 pyrsistent==0.16.0 docker==4.3.0 cryptography==3.0 \
  49. git+https://github.com/0k/compose@run_ignore_orphans
  50. # docker-compose==$DOCKER_COMPOSE_VERSION
  51. # pip install git+https://github.com/vaab/colour@master
  52. RUN curl -L https://git.0k.io/0k-charm.git/plain/bin/charm > /usr/local/bin/charm && \
  53. chmod +x /usr/local/bin/charm
  54. RUN curl -L https://git.0k.io/git-sub.git/plain/bin/git-sub > /usr/local/bin/git-sub && \
  55. chmod +x /usr/local/bin/git-sub
  56. RUN curl -L https://git.0k.io/0k-docker.git/plain/src/bin/dupd > /usr/local/bin/dupd && \
  57. chmod +x /usr/local/bin/dupd
  58. RUN curl http://docker.0k.io/get/ca.0k.io.pem > /usr/local/share/ca-certificates/ca.0k.io.pem
  59. ##force install pyyaml with libyaml
  60. RUN cd /tmp && \
  61. wget https://github.com/yaml/pyyaml/archive/4.1.tar.gz && \
  62. tar xvzf 4.1.tar.gz && \
  63. cd pyyaml-4.1 && \
  64. PYTHONPATH=/usr/lib/python2.7/site-packages python setup.py --with-libyaml install
  65. ## needed by 'xpath' script from kal-scripts for parsing html output
  66. RUN apk add libxslt-dev && \
  67. pip install lxml==4.5.2 html5lib==1.1 webencodings==0.5.1 && \
  68. wget "https://git.0k.io/kal-scripts.git/plain/src/bin/xpath?h=0k/dev/master&id=e04a1b7942cb39ff2515c7f666abd33bf621b119" -O /usr/local/bin/xpath && \
  69. chmod +x /usr/local/bin/xpath
  70. FROM common
  71. COPY --from=builder /etc/shlib /etc/shlib
  72. COPY --from=builder /usr/bin/bash-shlib /usr/bin/bash-shlib
  73. COPY --from=builder /usr/lib/shlib /usr/lib/shlib
  74. COPY --from=builder /usr/local /usr/local
  75. RUN cp /usr/local/share/ca-certificates/ca.0k.io.pem /etc/ssl/ca.0k.io.pem && \
  76. apk add ca-certificates && update-ca-certificates && \
  77. mkdir -p /etc/docker/certs.d/docker.0k.io && \
  78. ln -sfn /etc/ssl/ca.0k.io.pem /etc/docker/certs.d/docker.0k.io/ca.crt
  79. ## requiring ``stdbuf`` for actions
  80. RUN apk add coreutils
  81. ## requiring ``openssl`` command for certificate generation in charms
  82. RUN apk add openssl
  83. ## requiring ``htpasswd`` command for BCrypt encryption
  84. RUN apk add apache2-utils
  85. ## requiring ``jq`` command for json querying/modifying in charms
  86. RUN apk add jq
  87. ## requiring ``getfacl/setfacl`` command for allowing to setup some permissions in charms
  88. RUN apk add acl
  89. ## required by git through ssh (for host-resources for instance)
  90. RUN apk add openssh-client
  91. ## handy in some charms to poke at some services
  92. RUN apk add curl
  93. ## handy yaml2json converter for charm
  94. RUN wget https://github.com/bronze1man/yaml2json/releases/download/v1.3/yaml2json_linux_amd64 \
  95. -O /usr/local/bin/yaml2json && \
  96. chmod +x /usr/local/bin/yaml2json
  97. ## Fixing Let's encrypt CA issue from 2021-10-01, probably can remove
  98. ## with newer alpine version (was added with alpine 3.7.1)
  99. RUN sed -ri 's%^(mozilla/DST_Root_CA_X3.crt)%!\\1%g' /etc/ca-certificates.conf && \
  100. update-ca-certificates
  101. ## install compose
  102. COPY ./bin/ /usr/local/bin/
  103. ## Fixes Ctrl-C handling:
  104. ## see https://github.com/moby/moby/issues/2838#issuecomment-402491110
  105. RUN apk add --no-cache tini
  106. # Tini is now available at /sbin/tini
  107. ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/compose-core"]