Last active
August 20, 2017 14:55
-
-
Save inkel/17f5a1f728a7c0674b79 to your computer and use it in GitHub Desktop.
This file contains 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
# checker.rb | |
# https://blog.codeship.com/build-minimal-docker-container-ruby-apps/ | |
require 'rubygems' | |
require 'curb' | |
gem_name = ARGV[0] | |
raise ArgumentError.new("gem name missing") if gem_name.nil? | |
if Curl.get("https://rubygems.org/gems/#{gem_name}").status == '200 OK' | |
$stdout.puts 'Name not available.' | |
else | |
$stdout.puts 'Name available.' | |
end |
This file contains 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 alpine:3.2 | |
MAINTAINER Leandro López <[email protected]> | |
# Install base packages | |
RUN apk update && apk upgrade | |
# Install ruby and ruby-bundler | |
RUN apk add curl-dev ruby-dev build-base ruby | |
# Clean APK cache | |
RUN rm -rf /var/cache/apk/* | |
RUN mkdir /usr/app | |
WORKDIR /usr/app | |
COPY . /usr/app | |
RUN gem install --no-ri --no-rdoc -E curb | |
ENTRYPOINT ["ruby", "checker.rb"] |
This file contains 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
$ docker images | |
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE | |
ruby latest 7bacacd41c6d 3 minutes ago 183.2 MB |
This file contains 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
[ | |
{ | |
"Id": "7bacacd41c6d5cc37b9b0d71796b00cc97673df6cd1e2dc04ab8c98762db5e5a", | |
"Parent": "467e02a8493dcadd0061ec26e2f813dbf34b23f77b070ebfc979e01a023b4a5e", | |
"Comment": "", | |
"Created": "2015-07-20T22:16:41.836628382Z", | |
"Container": "c9dea761c45d22c333c67caa6bb98442dffbf11dbea476e6adc12d9a5ff2582d", | |
"ContainerConfig": { | |
"Hostname": "bfbdc5abbb9f", | |
"Domainname": "", | |
"User": "", | |
"AttachStdin": false, | |
"AttachStdout": false, | |
"AttachStderr": false, | |
"PortSpecs": null, | |
"ExposedPorts": null, | |
"Tty": false, | |
"OpenStdin": false, | |
"StdinOnce": false, | |
"Env": [ | |
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | |
], | |
"Cmd": [ | |
"/bin/sh", | |
"-c", | |
"#(nop) ENTRYPOINT \u0026{[\"ruby\" \"checker.rb\"]}" | |
], | |
"Image": "467e02a8493dcadd0061ec26e2f813dbf34b23f77b070ebfc979e01a023b4a5e", | |
"Volumes": null, | |
"VolumeDriver": "", | |
"WorkingDir": "/usr/app", | |
"Entrypoint": [ | |
"ruby", | |
"checker.rb" | |
], | |
"NetworkDisabled": false, | |
"MacAddress": "", | |
"OnBuild": [], | |
"Labels": {} | |
}, | |
"DockerVersion": "1.7.1", | |
"Author": "Leandro López \[email protected]\u003e", | |
"Config": { | |
"Hostname": "bfbdc5abbb9f", | |
"Domainname": "", | |
"User": "", | |
"AttachStdin": false, | |
"AttachStdout": false, | |
"AttachStderr": false, | |
"PortSpecs": null, | |
"ExposedPorts": null, | |
"Tty": false, | |
"OpenStdin": false, | |
"StdinOnce": false, | |
"Env": [ | |
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | |
], | |
"Cmd": null, | |
"Image": "467e02a8493dcadd0061ec26e2f813dbf34b23f77b070ebfc979e01a023b4a5e", | |
"Volumes": null, | |
"VolumeDriver": "", | |
"WorkingDir": "/usr/app", | |
"Entrypoint": [ | |
"ruby", | |
"checker.rb" | |
], | |
"NetworkDisabled": false, | |
"MacAddress": "", | |
"OnBuild": [], | |
"Labels": {} | |
}, | |
"Architecture": "amd64", | |
"Os": "linux", | |
"Size": 0, | |
"VirtualSize": 183156199 | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment