mirror of
https://github.com/docker-library/ruby.git
synced 2022-11-09 11:41:34 -05:00
Adjust the order we do things a bit to enable non-root usage trivially
This commit is contained in:
parent
e119577a01
commit
1e30dbd46c
3 changed files with 65 additions and 34 deletions
|
@ -1,14 +1,20 @@
|
||||||
FROM alpine:3.3
|
FROM alpine:3.3
|
||||||
|
|
||||||
|
# skip installing gem documentation
|
||||||
|
RUN mkdir -p /usr/local/etc \
|
||||||
|
&& { \
|
||||||
|
echo 'install: --no-document'; \
|
||||||
|
echo 'update: --no-document'; \
|
||||||
|
} >> /usr/local/etc/gemrc
|
||||||
|
|
||||||
ENV RUBY_MAJOR %%VERSION%%
|
ENV RUBY_MAJOR %%VERSION%%
|
||||||
ENV RUBY_VERSION %%FULL_VERSION%%
|
ENV RUBY_VERSION %%FULL_VERSION%%
|
||||||
ENV RUBY_DOWNLOAD_SHA256 %%SHA256%%
|
ENV RUBY_DOWNLOAD_SHA256 %%SHA256%%
|
||||||
ENV RUBYGEMS_VERSION %%RUBYGEMS%%
|
ENV RUBYGEMS_VERSION %%RUBYGEMS%%
|
||||||
|
|
||||||
# skip installing gem documentation
|
# some of ruby's build scripts are written in ruby
|
||||||
RUN echo -e 'install: --no-document\nupdate: --no-document' >> "$HOME/.gemrc"
|
# we purge this later to make sure our final image uses what we just built
|
||||||
|
RUN set -ex \
|
||||||
RUN set -x \
|
|
||||||
&& apk add --no-cache --virtual .ruby-builddeps \
|
&& apk add --no-cache --virtual .ruby-builddeps \
|
||||||
autoconf \
|
autoconf \
|
||||||
bison \
|
bison \
|
||||||
|
@ -40,12 +46,13 @@ RUN set -x \
|
||||||
&& mv "/usr/src/ruby-$RUBY_VERSION" /usr/src/ruby \
|
&& mv "/usr/src/ruby-$RUBY_VERSION" /usr/src/ruby \
|
||||||
&& rm ruby.tar.gz \
|
&& rm ruby.tar.gz \
|
||||||
&& cd /usr/src/ruby \
|
&& cd /usr/src/ruby \
|
||||||
|
&& { echo '#define ENABLE_PATH_CHECK 0'; echo; cat file.c; } > file.c.new && mv file.c.new file.c \
|
||||||
&& autoconf \
|
&& autoconf \
|
||||||
# the configure script does not detect isnan/isinf as macros
|
# the configure script does not detect isnan/isinf as macros
|
||||||
&& ac_cv_func_isnan=yes ac_cv_func_isinf=yes ./configure --disable-install-doc \
|
&& ac_cv_func_isnan=yes ac_cv_func_isinf=yes \
|
||||||
|
./configure --disable-install-doc \
|
||||||
&& make -j"$(nproc)" \
|
&& make -j"$(nproc)" \
|
||||||
&& make install \
|
&& make install \
|
||||||
&& gem update --system $RUBYGEMS_VERSION \
|
|
||||||
&& runDeps="$( \
|
&& runDeps="$( \
|
||||||
scanelf --needed --nobanner --recursive /usr/local \
|
scanelf --needed --nobanner --recursive /usr/local \
|
||||||
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
|
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
|
||||||
|
@ -63,17 +70,21 @@ RUN set -x \
|
||||||
procps \
|
procps \
|
||||||
zlib-dev \
|
zlib-dev \
|
||||||
&& apk del .ruby-builddeps \
|
&& apk del .ruby-builddeps \
|
||||||
|
&& gem update --system $RUBYGEMS_VERSION \
|
||||||
&& rm -r /usr/src/ruby
|
&& rm -r /usr/src/ruby
|
||||||
|
|
||||||
# install things globally, for great justice
|
|
||||||
ENV GEM_HOME /usr/local/bundle
|
|
||||||
ENV PATH $GEM_HOME/bin:$PATH
|
|
||||||
|
|
||||||
ENV BUNDLER_VERSION %%BUNDLER%%
|
ENV BUNDLER_VERSION %%BUNDLER%%
|
||||||
|
|
||||||
RUN gem install bundler --version "$BUNDLER_VERSION" \
|
RUN gem install bundler --version "$BUNDLER_VERSION" \
|
||||||
&& bundle config --global path "$GEM_HOME" \
|
&& bundle config --global path "$GEM_HOME" \
|
||||||
&& bundle config --global bin "$GEM_HOME/bin"
|
&& bundle config --global bin "$GEM_HOME/bin" \
|
||||||
|
&& bundle config --global silence_root_warning true
|
||||||
|
|
||||||
|
# install things globally, for great justice
|
||||||
|
ENV GEM_HOME /usr/local/bundle
|
||||||
|
ENV PATH $GEM_HOME/bin:$PATH
|
||||||
|
RUN mkdir -p "$GEM_HOME" \
|
||||||
|
&& chmod 777 "$GEM_HOME"
|
||||||
|
|
||||||
# don't create ".bundle" in all our apps
|
# don't create ".bundle" in all our apps
|
||||||
ENV BUNDLE_APP_CONFIG $GEM_HOME
|
ENV BUNDLE_APP_CONFIG $GEM_HOME
|
||||||
|
|
|
@ -13,17 +13,22 @@ RUN apt-get update \
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# skip installing gem documentation
|
||||||
|
RUN mkdir -p /usr/local/etc \
|
||||||
|
&& { \
|
||||||
|
echo 'install: --no-document'; \
|
||||||
|
echo 'update: --no-document'; \
|
||||||
|
} >> /usr/local/etc/gemrc
|
||||||
|
|
||||||
ENV RUBY_MAJOR %%VERSION%%
|
ENV RUBY_MAJOR %%VERSION%%
|
||||||
ENV RUBY_VERSION %%FULL_VERSION%%
|
ENV RUBY_VERSION %%FULL_VERSION%%
|
||||||
ENV RUBY_DOWNLOAD_SHA256 %%SHA256%%
|
ENV RUBY_DOWNLOAD_SHA256 %%SHA256%%
|
||||||
ENV RUBYGEMS_VERSION %%RUBYGEMS%%
|
ENV RUBYGEMS_VERSION %%RUBYGEMS%%
|
||||||
|
|
||||||
# skip installing gem documentation
|
|
||||||
RUN echo 'install: --no-document\nupdate: --no-document' >> "$HOME/.gemrc"
|
|
||||||
|
|
||||||
# some of ruby's build scripts are written in ruby
|
# some of ruby's build scripts are written in ruby
|
||||||
# we purge this later to make sure our final image uses what we just built
|
# we purge this later to make sure our final image uses what we just built
|
||||||
RUN buildDeps=' \
|
RUN set -ex \
|
||||||
|
&& buildDeps=' \
|
||||||
autoconf \
|
autoconf \
|
||||||
bison \
|
bison \
|
||||||
gcc \
|
gcc \
|
||||||
|
@ -37,27 +42,23 @@ RUN buildDeps=' \
|
||||||
make \
|
make \
|
||||||
ruby \
|
ruby \
|
||||||
' \
|
' \
|
||||||
&& set -x \
|
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends $buildDeps \
|
&& apt-get install -y --no-install-recommends $buildDeps \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& mkdir -p /usr/src/ruby \
|
|
||||||
&& curl -fSL -o ruby.tar.gz "http://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.gz" \
|
&& curl -fSL -o ruby.tar.gz "http://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.gz" \
|
||||||
&& echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.gz" | sha256sum -c - \
|
&& echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.gz" | sha256sum -c - \
|
||||||
|
&& mkdir -p /usr/src/ruby \
|
||||||
&& tar -xzf ruby.tar.gz -C /usr/src/ruby --strip-components=1 \
|
&& tar -xzf ruby.tar.gz -C /usr/src/ruby --strip-components=1 \
|
||||||
&& rm ruby.tar.gz \
|
&& rm ruby.tar.gz \
|
||||||
&& cd /usr/src/ruby \
|
&& cd /usr/src/ruby \
|
||||||
|
&& { echo '#define ENABLE_PATH_CHECK 0'; echo; cat file.c; } > file.c.new && mv file.c.new file.c \
|
||||||
&& autoconf \
|
&& autoconf \
|
||||||
&& ./configure --disable-install-doc \
|
&& ./configure --disable-install-doc \
|
||||||
&& make -j"$(nproc)" \
|
&& make -j"$(nproc)" \
|
||||||
&& make install \
|
&& make install \
|
||||||
|
&& apt-get purge -y --auto-remove $buildDeps \
|
||||||
&& gem update --system $RUBYGEMS_VERSION \
|
&& gem update --system $RUBYGEMS_VERSION \
|
||||||
&& rm -r /usr/src/ruby \
|
&& rm -r /usr/src/ruby
|
||||||
&& apt-get purge -y --auto-remove $buildDeps
|
|
||||||
|
|
||||||
# install things globally, for great justice
|
|
||||||
ENV GEM_HOME /usr/local/bundle
|
|
||||||
ENV PATH $GEM_HOME/bin:$PATH
|
|
||||||
|
|
||||||
ENV BUNDLER_VERSION %%BUNDLER%%
|
ENV BUNDLER_VERSION %%BUNDLER%%
|
||||||
|
|
||||||
|
@ -66,6 +67,12 @@ RUN gem install bundler --version "$BUNDLER_VERSION" \
|
||||||
&& bundle config --global bin "$GEM_HOME/bin" \
|
&& bundle config --global bin "$GEM_HOME/bin" \
|
||||||
&& bundle config --global silence_root_warning true
|
&& bundle config --global silence_root_warning true
|
||||||
|
|
||||||
|
# install things globally, for great justice
|
||||||
|
ENV GEM_HOME /usr/local/bundle
|
||||||
|
ENV PATH $GEM_HOME/bin:$PATH
|
||||||
|
RUN mkdir -p "$GEM_HOME" \
|
||||||
|
&& chmod 777 "$GEM_HOME"
|
||||||
|
|
||||||
# don't create ".bundle" in all our apps
|
# don't create ".bundle" in all our apps
|
||||||
ENV BUNDLE_APP_CONFIG $GEM_HOME
|
ENV BUNDLE_APP_CONFIG $GEM_HOME
|
||||||
|
|
||||||
|
|
|
@ -1,36 +1,43 @@
|
||||||
FROM buildpack-deps:jessie
|
FROM buildpack-deps:jessie
|
||||||
|
|
||||||
|
# skip installing gem documentation
|
||||||
|
RUN mkdir -p /usr/local/etc \
|
||||||
|
&& { \
|
||||||
|
echo 'install: --no-document'; \
|
||||||
|
echo 'update: --no-document'; \
|
||||||
|
} >> /usr/local/etc/gemrc
|
||||||
|
|
||||||
ENV RUBY_MAJOR %%VERSION%%
|
ENV RUBY_MAJOR %%VERSION%%
|
||||||
ENV RUBY_VERSION %%FULL_VERSION%%
|
ENV RUBY_VERSION %%FULL_VERSION%%
|
||||||
ENV RUBY_DOWNLOAD_SHA256 %%SHA256%%
|
ENV RUBY_DOWNLOAD_SHA256 %%SHA256%%
|
||||||
ENV RUBYGEMS_VERSION %%RUBYGEMS%%
|
ENV RUBYGEMS_VERSION %%RUBYGEMS%%
|
||||||
|
|
||||||
# skip installing gem documentation
|
|
||||||
RUN echo 'install: --no-document\nupdate: --no-document' >> "$HOME/.gemrc"
|
|
||||||
|
|
||||||
# some of ruby's build scripts are written in ruby
|
# some of ruby's build scripts are written in ruby
|
||||||
# we purge this later to make sure our final image uses what we just built
|
# we purge this later to make sure our final image uses what we just built
|
||||||
RUN apt-get update \
|
RUN set -ex \
|
||||||
&& apt-get install -y bison libgdbm-dev ruby \
|
&& buildDeps=' \
|
||||||
|
bison \
|
||||||
|
libgdbm-dev \
|
||||||
|
ruby \
|
||||||
|
' \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends $buildDeps \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& mkdir -p /usr/src/ruby \
|
|
||||||
&& curl -fSL -o ruby.tar.gz "http://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.gz" \
|
&& curl -fSL -o ruby.tar.gz "http://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.gz" \
|
||||||
&& echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.gz" | sha256sum -c - \
|
&& echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.gz" | sha256sum -c - \
|
||||||
|
&& mkdir -p /usr/src/ruby \
|
||||||
&& tar -xzf ruby.tar.gz -C /usr/src/ruby --strip-components=1 \
|
&& tar -xzf ruby.tar.gz -C /usr/src/ruby --strip-components=1 \
|
||||||
&& rm ruby.tar.gz \
|
&& rm ruby.tar.gz \
|
||||||
&& cd /usr/src/ruby \
|
&& cd /usr/src/ruby \
|
||||||
|
&& { echo '#define ENABLE_PATH_CHECK 0'; echo; cat file.c; } > file.c.new && mv file.c.new file.c \
|
||||||
&& autoconf \
|
&& autoconf \
|
||||||
&& ./configure --disable-install-doc \
|
&& ./configure --disable-install-doc \
|
||||||
&& make -j"$(nproc)" \
|
&& make -j"$(nproc)" \
|
||||||
&& make install \
|
&& make install \
|
||||||
&& apt-get purge -y --auto-remove bison libgdbm-dev ruby \
|
&& apt-get purge -y --auto-remove $buildDeps \
|
||||||
&& gem update --system $RUBYGEMS_VERSION \
|
&& gem update --system $RUBYGEMS_VERSION \
|
||||||
&& rm -r /usr/src/ruby
|
&& rm -r /usr/src/ruby
|
||||||
|
|
||||||
# install things globally, for great justice
|
|
||||||
ENV GEM_HOME /usr/local/bundle
|
|
||||||
ENV PATH $GEM_HOME/bin:$PATH
|
|
||||||
|
|
||||||
ENV BUNDLER_VERSION %%BUNDLER%%
|
ENV BUNDLER_VERSION %%BUNDLER%%
|
||||||
|
|
||||||
RUN gem install bundler --version "$BUNDLER_VERSION" \
|
RUN gem install bundler --version "$BUNDLER_VERSION" \
|
||||||
|
@ -38,6 +45,12 @@ RUN gem install bundler --version "$BUNDLER_VERSION" \
|
||||||
&& bundle config --global bin "$GEM_HOME/bin" \
|
&& bundle config --global bin "$GEM_HOME/bin" \
|
||||||
&& bundle config --global silence_root_warning true
|
&& bundle config --global silence_root_warning true
|
||||||
|
|
||||||
|
# install things globally, for great justice
|
||||||
|
ENV GEM_HOME /usr/local/bundle
|
||||||
|
ENV PATH $GEM_HOME/bin:$PATH
|
||||||
|
RUN mkdir -p "$GEM_HOME" \
|
||||||
|
&& chmod 777 "$GEM_HOME"
|
||||||
|
|
||||||
# don't create ".bundle" in all our apps
|
# don't create ".bundle" in all our apps
|
||||||
ENV BUNDLE_APP_CONFIG $GEM_HOME
|
ENV BUNDLE_APP_CONFIG $GEM_HOME
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue