-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ruby alpine #60
Ruby alpine #60
Conversation
Closes #62. Didn't see this PR. 👍 Could be possible to have |
The one I provided corresponds to the slim variant. I don't know if we want a non-slim variant for alpine? We don't have any buildpack-deps alpine variant (yet). Do we want that? |
That's what I need. But this could make used confused IMO. Let's repo owners decide for this. 👍 |
I'm surprised of the size: https://travis-ci.org/docker-library/ruby/jobs/100615032#L1949 I made a Genghis Docker image based on Alpine with ruby base installed and this get less than 30 MB. |
Yes, you used the alpine ruby package, which strips documentation, split out development headers, irb, static libraries and similar. The ruby:*-alpine docker images are closer to what upstream does and it also includes some build time dependencies similar to what debian based image does. (I suppose for building native extensions?) ruby 2.3-alpine b239b06f434c 11 days ago 121.2 MB
ruby 2.3-slim a557ba5674a0 2 weeks ago 278.7 MB |
This is what
In my case, it's for a "ready to use" Ruby app that should no be extended on other Dockerfile, so I just need the minimal. |
diff --git a/2.3/slim/Dockerfile b/2.3/alpine/Dockerfile
index 4abb8ce..bcfd8ec 100644
--- a/2.3/slim/Dockerfile
+++ b/2.3/alpine/Dockerfile
@@ -1,17 +1,4 @@
-FROM debian:jessie
-
-RUN apt-get update \
- && apt-get install -y --no-install-recommends \
- bzip2 \
- ca-certificates \
- curl \
- libffi-dev \
- libgdbm3 \
- libssl-dev \
- libyaml-dev \
- procps \
- zlib1g-dev \
- && rm -rf /var/lib/apt/lists/*
+FROM alpine:3.3
ENV RUBY_MAJOR 2.3
ENV RUBY_VERSION 2.3.0
@@ -19,41 +6,64 @@ ENV RUBY_DOWNLOAD_SHA256 ba5ba60e5f1aa21b4ef8e9bf35b9ddb57286cb546aac4b5a28c71f4
ENV RUBYGEMS_VERSION 2.5.1
# skip installing gem documentation
-RUN echo 'install: --no-document\nupdate: --no-document' >> "$HOME/.gemrc"
+RUN echo -e 'install: --no-document\nupdate: --no-document' >> "$HOME/.gemrc"
-# 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
-RUN buildDeps=' \
+RUN set -x \
+ && apk add --no-cache --virtual .ruby-builddeps \
autoconf \
bison \
+ bzip2 \
+ bzip2-dev \
+ ca-certificates \
+ coreutils \
+ curl \
gcc \
- libbz2-dev \
- libgdbm-dev \
- libglib2.0-dev \
- libncurses-dev \
- libreadline-dev \
+ gdbm-dev \
+ glib-dev \
+ libc-dev \
+ libedit-dev \
+ libffi-dev \
libxml2-dev \
libxslt-dev \
+ linux-headers \
make \
+ ncurses-dev \
+ openssl-dev \
+ procps \
ruby \
- ' \
- && set -x \
- && apt-get update \
- && apt-get install -y --no-install-recommends $buildDeps \
- && rm -rf /var/lib/apt/lists/* \
- && mkdir -p /usr/src/ruby \
+ yaml-dev \
+ zlib-dev \
&& 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 - \
- && tar -xzf ruby.tar.gz -C /usr/src/ruby --strip-components=1 \
+ && mkdir -p /usr/src \
+ && tar -xzf ruby.tar.gz -C /usr/src \
+ && mv "/usr/src/ruby-$RUBY_VERSION" /usr/src/ruby \
&& rm ruby.tar.gz \
&& cd /usr/src/ruby \
&& autoconf \
- && ./configure --disable-install-doc \
+ # the configure script does not detect isnan/isinf as macros
+ && ac_cv_func_isnan=yes ac_cv_func_isinf=yes ./configure --disable-install-doc \
&& make -j"$(nproc)" \
&& make install \
&& gem update --system $RUBYGEMS_VERSION \
- && rm -r /usr/src/ruby \
- && apt-get purge -y --auto-remove $buildDeps
+ && runDeps="$( \
+ scanelf --needed --nobanner --recursive /usr/local \
+ | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
+ | sort -u \
+ | xargs -r apk info --installed \
+ | sort -u \
+ )" \
+ && apk add --virtual .ruby-rundeps $runDeps \
+ bzip2 \
+ ca-certificates \
+ curl \
+ libffi-dev \
+ openssl-dev \
+ yaml-dev \
+ procps \
+ zlib-dev \
+ && apk del .ruby-builddeps \
+ && rm -r /usr/src/ruby
# install things globally, for great justice
ENV GEM_HOME /usr/local/bundle |
LGTM |
- `mariadb`: 10.1.11+maria-1~jessie, fix `pwgen` (MariaDB/mariadb-docker#40) - `percona`: fix `pwgen` (docker-library/percona#13) - `redis`: 3.0.7 - `ruby`: add new `alpine` variants (docker-library/ruby#60, docker-library/ruby#65)
- `mariadb`: 10.1.11+maria-1~jessie, fix `pwgen` (MariaDB/mariadb-docker#40) - `percona`: fix `pwgen` (docker-library/percona#13) - `redis`: 3.0.7 - `ruby`: add new `alpine` variants (docker-library/ruby#60, docker-library/ruby#65)
No description provided.