Initial commit

This commit is contained in:
nemunaire 2019-11-26 20:43:48 +01:00
commit e143984090
8 changed files with 205 additions and 0 deletions

7
hasher/Dockerfile Normal file
View file

@ -0,0 +1,7 @@
FROM ruby:alpine
RUN apk add --update build-base curl
RUN gem install sinatra
RUN gem install thin
ADD hasher.rb /
CMD ["ruby", "hasher.rb"]
EXPOSE 80

18
hasher/hasher.rb Normal file
View file

@ -0,0 +1,18 @@
require 'digest'
require 'sinatra'
require 'socket'
set :bind, '0.0.0.0'
set :port, 80
post '/' do
# Simulate a bit of delay
sleep 0.1
content_type 'text/plain'
"#{Digest::SHA2.new().update(request.body.read)}"
end
get '/' do
"HASHER running on #{Socket.gethostname}\n"
end