├── Makefile ├── Dockerfile └── README.md /Makefile: -------------------------------------------------------------------------------- 1 | DUMMY: build 2 | VERSION:=2.3 3 | 4 | build: 5 | docker build -t cybercode/alpine-ruby:$(VERSION) $(ARGS) . 6 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.5 2 | 3 | RUN apk update && apk upgrade && apk --update add \ 4 | ruby ruby-irb ruby-rake ruby-io-console ruby-bigdecimal ruby-json ruby-bundler \ 5 | libstdc++ tzdata bash ca-certificates \ 6 | && echo 'gem: --no-document' > /etc/gemrc 7 | 8 | CMD ["irb"] 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # `alpine-ruby`: Minimal Ruby image 2 | 3 | This is a *VERY* small mri ruby 2.2.3 image. It uses the [Alpine Linux](https://www.alpinelinux.org) ruby packages, and has `bundler` and minimal ruby packages installed. 4 | 5 | ## Using this package 6 | 7 | ``` Dockerfile 8 | FROM cybercode/alpine-ruby:2.3 9 | CMD["/mycommand"] 10 | ``` 11 | 12 | Unlike the [Official Ruby Image](https://hub.docker.com/_/ruby/) or [tinycore-ruby](https://hub.docker.com/r/tatsushid/tinycore-ruby/), it does not create any users or do `ONBUILD` magic and the `CMD` defaults to `irb`. 13 | 14 | ### Using C-based gems 15 | 16 | This image does not contain a compiler, etc. The best way to install C-based gems is to install the compiler chain and any development libraries required, run bundle install and remove the libraries all in one `RUN` command. That way the the final image will stay small. 17 | 18 | For example, if you are using the `pg` and `nokogiri` gems: 19 | 20 | ``` Dockerfile 21 | RUN apk --update add --virtual build_deps \ 22 | build-base ruby-dev libc-dev linux-headers \ 23 | openssl-dev postgresql-dev libxml2-dev libxslt-dev && \ 24 | sudo -iu app bundle install --path vendor/bundle && \ 25 | apk del build_deps 26 | ``` 27 | 28 | **Note**: These instructions used to suggest 29 | 30 | ``` Dockerfile 31 | sudo -iu app bundle config build.nokogiri --use-system-libraries 32 | ``` 33 | 34 | before the bundle install. 35 | 36 | This fails w/ alpine 3.4 as there is a conflict with the system header files. 37 | --------------------------------------------------------------------------------