From 3cc5b3adee2484e1d453a8fc62e16af302a8312e Mon Sep 17 00:00:00 2001 From: Georgios Gousios Date: Thu, 19 Dec 2019 17:48:36 +0100 Subject: [PATCH] Dispatch script for the kubernetes container --- Dockerfile | 4 +--- bin/docker-init.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100755 bin/docker-init.sh diff --git a/Dockerfile b/Dockerfile index 5d00cde..9ed1e07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,5 @@ COPY Gemfile ghtorrent.gemspec ./ghtorrent/ COPY lib/ ./ghtorrent/lib/ COPY bin/ ./ghtorrent/bin RUN cd ghtorrent && bundle install --without development test -RUN cd ghtorrent && gem install sqlite3 -CMD /usr/bin/env bash -#ENTRYPOINT ["/usr/local/bin/ruby", "-I/ghtorrent/lib", "/ghtorrent/bin/ght-retrieve-repo"] +ENTRYPOINT ["/ghtorrent/bin/docker-init.sh"] diff --git a/bin/docker-init.sh b/bin/docker-init.sh new file mode 100755 index 0000000..5a46513 --- /dev/null +++ b/bin/docker-init.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +usage() +{ +cat <&2 +Usage: $0 [command] + +Dispatch to a GHTorrent data retrieval operation + +[command] can be one of: events, data-retrival, load + are passed verbatim to the dispatched program +EOF +} + +cmd="" +case $1 in + events) + cmd="/usr/local/bin/ruby -I/ghtorrent/lib/ /ghtorrent/bin/ght-mirror-events" + ;; + data-retrieval) + cmd="/usr/local/bin/ruby -I/ghtorrent/lib/ /ghtorrent/bin/ght-data-retrieval" + ;; + load) + cmd="/usr/local/bin/ruby -I/ghtorrent/lib/ /ghtorrent/bin/ght-load" + ;; + *) + usage + ;; +esac + +shift + +$cmd $@