Last active
December 29, 2015 15:19
-
-
Save jphastings/7689569 to your computer and use it in GitHub Desktop.
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 custom/ruby | |
ADD . /src | |
WORKDIR /src | |
# NB. I'm installing ruby with RVM, so I have to run these commands via bash to get rvm to start up | |
RUN /bin/bash -lc bundle install --deployment --path ./vendor | |
EXPOSE 80 | |
ENTRYPOINT ["/bin/bash", "-lc", "bundle exec ruby serve.rb"] |
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
source "https://rubygems.org" | |
ruby "2.0.0" | |
gem "sinatra" |
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
require "sinatra" | |
set :port, 80 | |
get "/" do | |
"DEMO time" | |
end |
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
$ sudo docker build -t custom/demo . | |
Uploading context 10240 bytes | |
Step 1 : FROM custom/ruby | |
---> b0a81cbfbc4a | |
Step 2 : ADD . /src | |
---> d32b9263ff52 | |
Step 3 : WORKDIR /src | |
---> Running in c61aacbe9d2a | |
---> 2f3591425c9c | |
Step 4 : RUN /bin/bash -lc bundle install --deployment --path ./vendor | |
---> Running in c6ac45dcfcd6 | |
Fetching gem metadata from https://rubygems.org/........... | |
Fetching gem metadata from https://rubygems.org/.. | |
Resolving dependencies... | |
Installing rack (1.5.2) | |
Installing rack-protection (1.5.1) | |
Installing tilt (1.4.1) | |
Installing sinatra (1.4.4) | |
Using bundler (1.3.5) | |
Your bundle is complete! | |
Use `bundle show [gemname]` to see where a bundled gem is installed. | |
---> 959bf9d951e4 | |
Step 5 : EXPOSE 80 | |
---> Running in 633726f1efda | |
---> 16219e18d4ec | |
Step 6 : ENTRYPOINT ["/bin/bash", "-lc", "bundle exec ruby serve.rb"] | |
---> Running in abcca9b078e8 | |
---> 5480ee01599a | |
Successfully built 5480ee01599a | |
$ sudo docker run -P custom/demo | |
[2013-11-28 04:45:06] INFO WEBrick 1.3.1 | |
[2013-11-28 04:45:06] INFO ruby 2.0.0 (2013-11-22) [x86_64-linux] | |
== Sinatra/1.4.4 has taken the stage on 80 for development with backup from WEBrick | |
[2013-11-28 04:45:06] INFO WEBrick::HTTPServer#start: pid=1 port=80 | |
# In a new terminal | |
$ sudo docker ps | |
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
f3d2978b4d71 custom/demo:latest /bin/bash -lc bundle 5 minutes ago Up 5 minutes 0.0.0.0:49163->80/tcp clever_galileo | |
$ curl 0.0.0.0:49163 | |
curl: (56) Recv failure: Connection reset by peer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Results from
netstat -tulpn
:And
curl 0.0.0.0:80
gives "DEMO time" as expected.