Last active
September 4, 2019 13:31
-
-
Save helstern/99f858c04264b71de157579b9f0f1809 to your computer and use it in GitHub Desktop.
ruby container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | |
| PROJECT_ROOT := $(dir $(mkfile_path)) | |
| PROJECT_NAME := $(basename $(PROJECT_ROOT)) | |
| docker-build-2.5: | |
| docker build --tag rhelstern-ruby:2.5.5 --file ruby-2.5.Dockerfile . | |
| docker-build-2.3: | |
| docker build --tag rhelstern-ruby:2.3.3 --file ruby-2.3.Dockerfile . | |
| docker-run-2.5: | |
| docker run --rm \ | |
| --network host \ | |
| --volume ${PROJECT_ROOT}:/home/ruby/${PROJECT_NAME} \ | |
| --volume $$HOME/.ssh:/home/ruby/.ssh \ | |
| -w=/home/ruby/${PROJECT_NAME} \ | |
| --user 1000 \ | |
| -it rhelstern-ruby:2.5.5 \ | |
| /bin/bash | |
| docker-run-2.3: | |
| docker run --rm \ | |
| --network host \ | |
| --volume ${PROJECT_ROOT}:/home/ruby/${PROJECT_NAME} \ | |
| --volume $$HOME/.ssh:/home/ruby/.ssh \ | |
| -w=/home/ruby/${PROJECT_NAME} \ | |
| --user 1000 \ | |
| -it rhelstern-ruby:2.3.3 \ | |
| /bin/bash | |
| .PHONY: docker-run-2.5 docker-run-2.3 docker-build-2.5 docker-build-2.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM ruby:2.3.3-alpine | |
| RUN apk add --no-cache bash gawk sed grep bc coreutils git less openssh curl jq | |
| RUN addgroup -g 1000 ruby \ | |
| && adduser \ | |
| -S \ | |
| -h /home/ruby \ | |
| -G ruby \ | |
| -u 1000 \ | |
| ruby | |
| RUN apk add --no-cache \ | |
| # gem 'oj', 'puma', 'byebug' | |
| make gcc libc-dev \ | |
| # gem 'nokogiri' | |
| # bundle config --global build.nokogiri --use-system-libraries && \ | |
| # apk --no-cache add make libxml2 libxslt-dev g++ && \ | |
| make libxml2 libxslt-dev g++ \ | |
| # gem 'rb-readline' | |
| ncurses \ | |
| # gem 'ffi' | |
| libffi-dev \ | |
| # gem 'mysql2' | |
| mysql-dev \ | |
| # gem 'unf_ext' | |
| g++ \ | |
| # gem 'tiny_tds' | |
| freetds-dev \ | |
| # if you want to run git or something that requires ssl dependencies | |
| ca-certificates git \ | |
| alpine-sdk build-base | |
| # we don't want bundler > 2, perhaps should go with gem install bundler -v '< 2' | |
| RUN gem uninstall -i /usr/local/lib/ruby/gems/2.3.0 --force bundler; gem install bundler -v '1.17.3' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM ruby:2.5.5-alpine3.10 | |
| RUN apk add --no-cache bash gawk sed grep bc coreutils git less openssh curl jq \ | |
| && addgroup --gid 1000 ruby \ | |
| && adduser \ | |
| --disabled-password \ | |
| --gecos "" \ | |
| --home /home/ruby \ | |
| --ingroup ruby \ | |
| --uid 1000 \ | |
| ruby | |
| RUN gem uninstall --force bundler | |
| RUN \ | |
| # gem 'oj', 'puma', 'byebug' | |
| apk add --no-cache make gcc libc-dev && \ | |
| # gem 'nokogiri' | |
| bundle config --global build.nokogiri --use-system-libraries && \ | |
| apk add --no-cache make libxml2 libxslt-dev g++ && \ | |
| # gem 'rb-readline' | |
| apk add --no-cache ncurses && \ | |
| # gem 'ffi' | |
| apk add --no-cache libffi-dev && \ | |
| # gem 'mysql2' | |
| apk add --no-cache mysql-dev && \ | |
| # gem 'unf_ext' | |
| apk add --no-cache g++ && \ | |
| # gem 'tiny_tds' | |
| apk add --no-cache freetds-dev && \ | |
| # app dependencies | |
| apk add --no-cache ca-certificates git && \ | |
| apk add --no-cache alpine-sdk build-base |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to run this: copy the files in the root of your project, then for
ruby 2.5runmake docker-build-2.5# this builds ruby 2.5and
make docker-run-2.5to run an interactive bash 4.3 console inside the containerIf you run this on mac, you will probably need to add this line to your
~/.ssh/config filein all yourHoststanzas :IgnoreUnknown UseKeychain