From c7df5b71da152fa9012916ee6bf6075f40dd5ced Mon Sep 17 00:00:00 2001 From: Gustavo Pantuza Date: Mon, 16 Nov 2020 15:36:59 -0300 Subject: [PATCH 1/2] Adds Dockerfile to allow using Webrisk Proxy Server as a container --- Dockerfile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..98f19ce --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +FROM golang:alpine + + +WORKDIR /go/src/webrisk + + +RUN apk add --update --no-cache git + + +# Gets the Proxy server binary +RUN go get github.com/google/webrisk/cmd/wrserver + + +# If you want to run a container with a different API KEY you can just +# pass this variable as `docker run` argument: +# docker run -e WR_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXX +ARG WR_API_KEY + + +# If you want to change the Proxy server port you can pass this +# variable as `docker run` argument: +# docker run -e WR_PROXY_PORT=5000 +ARG WR_PROXY_PORT + + +# In case no WR_PROXY_PORT is informed, default value is 8080 +ENV WR_PROXY_PORT=8080 + + +# Runs the WebRisk Proxy Server +CMD /go/bin/wrserver \ + -apikey=${WR_API_KEY} \ + -srvaddr=0.0.0.0:${WR_PROXY_PORT} \ + -db=/tmp/webrisk.db From 0c5c110c51d1fd970e742c8ccb8bb823d1b8bd4e Mon Sep 17 00:00:00 2001 From: Gustavo Pantuza Date: Mon, 16 Nov 2020 15:49:56 -0300 Subject: [PATCH 2/2] Adds instructions on how to build and run docker image locally --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index d06dfdd..7224773 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,14 @@ To use the local proxy server to check a URL, send a POST request to `127.0.0.1: ] } ``` +4. Or, if you would like to run the Proxy server as a container you can do as follows: +```bash +$> docker build --tag webrisk:local . +``` +Once the image is built locally, you can run it: +```bash +$> docker run -it --rm -p 8080:8080 -e WR_API_KEY=XXXXXXXXXXX --name webrisk webrisk:local +``` # Command-Line Lookup