Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #5 from secureCodeBox/feature/docker-health
Browse files Browse the repository at this point in the history
Feature/docker health
  • Loading branch information
MartinLang1 authored Nov 12, 2018
2 parents d2183bd + 5554920 commit df6d703
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
FROM ruby:alpine

RUN apk update && apk upgrade && apk add perl perl-net-ssleay make g++ openssl
RUN apk update && apk upgrade && apk add perl perl-net-ssleay make g++ openssl curl

WORKDIR /sectools/

RUN wget https://github.com/sullo/nikto/archive/master.tar.gz -P /sectools && \
tar zxvf /sectools/master.tar.gz -C /sectools && \
rm /sectools/master.tar.gz

HEALTHCHECK --interval=30s --timeout=5s --start-period=120s --retries=3 CMD curl --fail http://localhost:8080/status || exit 1

COPY Gemfile src/

RUN bundle install --gemfile=/sectools/src/Gemfile
Expand Down
6 changes: 3 additions & 3 deletions src/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
get '/status' do

status 500
if (healthcheck(client.last_connect) == "UP")
if (scanner_test == "SUCCESSFUL")
status 200
end

Expand Down Expand Up @@ -46,7 +46,7 @@
end

def healthcheck(connection)
if (connection != "ERROR" && scanner_test == "SUCCESSFULL")
if (connection != "ERROR" && scanner_test == "SUCCESSFUL")
return "UP"
end
return "DOWN"
Expand All @@ -55,7 +55,7 @@ def healthcheck(connection)
def scanner_test
system('perl /sectools/nikto-master/program/nikto.pl -Version > /dev/null')
if $? == 0
return "SUCCESSFULL"
return "SUCCESSFUL"
else
return "FAILED"
end
Expand Down

0 comments on commit df6d703

Please sign in to comment.