oxml_xxe
oxml_xxe copied to clipboard
Add official dockerfile+build
It would be great if there was an official dockerfile and automated build on dockerhub.
I can see some previous work on https://github.com/nahidupa/oxml_xxe/blob/master/Dockerfile by @nahidupa , but it appears that hasn't been pushed to dockerhub:
- https://hub.docker.com/r/nahidupa/oxml_xxe/tags/
I've started work on my own, which may evolve over time into a more compact alpine linux container, assuming it runs properly there:
- https://github.com/alias1/docker-oxml_xxe
Ideally it would be awesome to see this built against alpine linux.
Great idea.
To confirm, the next steps would be:
- Test Dockerfile build for alpine and ubuntu
- Push to Dockerhub
- Link to supported Docker images in README.md
Sounds like a good path!
This should be all that's required to get this going, in theory. Could probably be optimized for size better still:
- https://github.com/alias1/docker-oxml_xxe/blob/master/Dockerfile
When running it, I seem to be unable to access the exposed port from my browser though. Wondering if there is some localhost type binding in the container that isn't playing nicely with things?
@alias1 I had a look at it. Webrick, by default, only serves on localhost. -o
is required if you want to expose it to other network interface.
I don't know if it's a good idea to have it as 0.0.0.0, but I'll leave it for someone to decide. 😄
Ah, that makes sense. Was thinking along similar lines, but thought docker's port mapping may have overcome it. I guess not.
Updated my Dockerfile
to include the above, seems to work now.
https://github.com/0xdevalias/docker-oxml_xxe/blob/ead927e072dbe49c78cba7355ec4a9e1ce3595d5/Dockerfile#L10-L11
It builds to ~200mb, could almost certainly optimize it since most of that weight seems to come from the apt-get installs, but not a high priority for me currently.
Related: https://github.com/0xdevalias/docker-oxml_xxe/issues/3
Thanks!! Added a docker directory with your code, I can take PRs into that if you want. Would be great to have this in master.
The Docker build is broken now:
$ docker-compose up --build
Building web
Step 1/6 : FROM ruby:2.6.2-slim
---> 05e2c7d06818
Step 2/6 : RUN apt-get update && apt-get install -y make git libsqlite3-dev libxslt-dev libxml2-dev zlib1g-dev gcc && apt-get clean
---> Using cache
---> 62c536476d63
Step 3/6 : RUN git clone --depth=1 https://github.com/BuffaloWill/oxml_xxe.git /oxml_xxe && cd /oxml_xxe && bundle install
---> Using cache
---> 67fc24960c2c
Step 4/6 : WORKDIR /oxml_xxe
---> Using cache
---> ac45946fe82c
Step 5/6 : EXPOSE 4567
---> Using cache
---> 26c8163ec4ee
Step 6/6 : ENTRYPOINT ["ruby", "server.rb", "-o", "0.0.0.0"]
---> Using cache
---> c3b69fe179b7
Successfully built c3b69fe179b7
Successfully tagged docker_web:latest
Starting docker_web_1 ... done
Attaching to docker_web_1
web_1 | /usr/local/lib/ruby/2.6.0/rubygems/specification.rb:2302:in `raise_if_conflicts': Unable to activate dm-serializer-1.2.2, because json-2.1.0 conflicts with json (~> 1.6) (Gem::ConflictError)
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/specification.rb:1418:in `activate'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/specification.rb:1452:in `block in activate_dependencies'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/specification.rb:1438:in `each'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/specification.rb:1438:in `activate_dependencies'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/specification.rb:1420:in `activate'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems.rb:223:in `rescue in try_activate'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems.rb:216:in `try_activate'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:123:in `rescue in require'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
web_1 | from /oxml_xxe/model/master.rb:2:in `<top (required)>'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
web_1 | from server.rb:11:in `<main>'
web_1 | /usr/local/lib/ruby/2.6.0/rubygems/specification.rb:2302:in `raise_if_conflicts': Unable to activate dm-serializer-1.2.2, because json-2.1.0 conflicts with json (~> 1.6) (Gem::ConflictError)
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/specification.rb:1418:in `activate'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/specification.rb:1452:in `block in activate_dependencies'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/specification.rb:1438:in `each'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/specification.rb:1438:in `activate_dependencies'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/specification.rb:1420:in `activate'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems.rb:217:in `try_activate'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:123:in `rescue in require'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
web_1 | from /oxml_xxe/model/master.rb:2:in `<top (required)>'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
web_1 | from server.rb:11:in `<main>'
web_1 | /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- data_mapper (LoadError)
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
web_1 | from /oxml_xxe/model/master.rb:2:in `<top (required)>'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
web_1 | from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
web_1 | from server.rb:11:in `<main>'
docker_web_1 exited with code 1