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 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