diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..718ed42 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM golang:1.16-alpine + +WORKDIR /src/ +COPY * /src/ + +RUN apk add --update alpine-sdk \ + && make \ + && mv bin/restockbot /usr/local/bin/restockbot \ + && rm -rf /src/* + +WORKDIR /root/ diff --git a/README.md b/README.md index bb78fc1..1af26a3 100644 --- a/README.md +++ b/README.md @@ -22,20 +22,15 @@ Follow [this procedure](https://github.com/jouir/twitter-login) to generate all * `access_token` * `access_token_secret` -## Installation +## Compilation + +### With pre-built binaries Download the latest [release](https://github.com/jouir/restockbot/releases). Ensure checksums are identical. -Then execute the binary: - -``` -./restockbot -version -./restockbot -help -``` - -## Compilation +### With make Clone the repository: ``` @@ -60,6 +55,12 @@ Eventually remove produced binaries with: make clean ``` +### With Docker + +``` +docker image build -t restockbot:$(cat VERSION) . +``` + ## Configuration Default file is `restockbot.json` in the current directory. The file name can be passed with the `-config` argument. @@ -77,6 +78,20 @@ Options: * `exclude_regex` (optional): exclude products with a name matching this regexp * `browser_address` (optional): set headless browser address (ex: `http://127.0.0.1:9222`) +## Usage + +### With binary + +``` +restockbot -help +``` + +### With Docker + +``` +docker run -it --name restockbot --rm --link chromium:chromium -v $(pwd):/root/ restockbot:$(cat VERSION) restockbot -help +``` + ## How to contribute Lint the code with pre-commit: @@ -166,4 +181,4 @@ Products will then be parsed. ## Disclaimer -Crawling a website should be used with caution. Please check with retailers if the bot respects the terms of use for their websites. Authors of the bot are not responsible of the bot usage. \ No newline at end of file +Crawling a website should be used with caution. Please check with retailers if the bot respects the terms of use for their websites. Authors of the bot are not responsible of the bot usage.