Advertisement
Guest User

Untitled

a guest
Oct 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. FROM alpine:3.6
  2.  
  3. # skip installing gem documentation
  4. RUN mkdir -p /usr/local/etc \
  5. && { \
  6. echo 'install: --no-document'; \
  7. echo 'update: --no-document'; \
  8. } >> /usr/local/etc/gemrc
  9.  
  10. ENV RUBY_MAJOR 1.8
  11. ENV RUBY_VERSION 1.8.7-p374
  12. ENV RUBY_DOWNLOAD_SHA256 876eeeaaeeab10cbf4767833547d66d86d6717ef48fd3d89e27db8926a65276c
  13.  
  14. # some of ruby's build scripts are written in ruby
  15. # we purge system ruby later to make sure our final image uses what we just built
  16. # readline-dev vs libedit-dev: https://bugs.ruby-lang.org/issues/11869 and https://github.com/docker-library/ruby/issues/75
  17. RUN set -ex \
  18. \
  19. && apk add --no-cache --virtual .ruby-builddeps \
  20. autoconf \
  21. bison \
  22. bzip2 \
  23. bzip2-dev \
  24. ca-certificates \
  25. coreutils \
  26. dpkg-dev dpkg \
  27. gcc \
  28. gdbm-dev \
  29. glib-dev \
  30. libc-dev \
  31. libffi-dev \
  32. libressl \
  33. libressl-dev \
  34. libxml2-dev \
  35. libxslt-dev \
  36. linux-headers \
  37. make \
  38. ncurses-dev \
  39. procps \
  40. readline-dev \
  41. ruby \
  42. tar \
  43. xz \
  44. yaml-dev \
  45. zlib-dev \
  46. \
  47. && wget -O ruby.tar.gz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.gz" \
  48. && echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.gz" | sha256sum -c - \
  49. \
  50. && mkdir -p /usr/src/ruby \
  51. && tar -xzf ruby.tar.gz -C /usr/src/ruby --strip-components=1 \
  52. && rm ruby.tar.gz \
  53. \
  54. && cd /usr/src/ruby \
  55. \
  56. # hack in "ENABLE_PATH_CHECK" disabling to suppress:
  57. # warning: Insecure world writable dir
  58. && { \
  59. echo '#define ENABLE_PATH_CHECK 0'; \
  60. echo; \
  61. cat file.c; \
  62. } > file.c.new \
  63. && mv file.c.new file.c \
  64. \
  65. && autoconf \
  66. && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
  67. # the configure script does not detect isnan/isinf as macros
  68. && export ac_cv_func_isnan=yes ac_cv_func_isinf=yes \
  69. && ./configure \
  70. --build="$gnuArch" \
  71. --disable-install-doc \
  72. --enable-shared \
  73. && make -j "$(nproc)" \
  74. && make install \
  75. \
  76. && runDeps="$( \
  77. scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
  78. | tr ',' '\n' \
  79. | sort -u \
  80. | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
  81. )" \
  82. && apk add --virtual .ruby-rundeps $runDeps \
  83. bzip2 \
  84. ca-certificates \
  85. libffi-dev \
  86. libressl-dev \
  87. procps \
  88. yaml-dev \
  89. zlib-dev \
  90. && apk del .ruby-builddeps \
  91. && cd / \
  92. && rm -r /usr/src/ruby \
  93. \
  94. && gem update --system
  95.  
  96. ENV BUNDLER_VERSION 1.15.4
  97.  
  98. RUN gem install bundler --version "$BUNDLER_VERSION"
  99.  
  100. # install things globally, for great justice
  101. # and don't create ".bundle" in all our apps
  102. ENV GEM_HOME /usr/local/bundle
  103. ENV BUNDLE_PATH="$GEM_HOME" \
  104. BUNDLE_BIN="$GEM_HOME/bin" \
  105. BUNDLE_SILENCE_ROOT_WARNING=1 \
  106. BUNDLE_APP_CONFIG="$GEM_HOME"
  107. ENV PATH $BUNDLE_BIN:$PATH
  108. RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
  109. && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
  110.  
  111. CMD [ "irb" ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement