diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b4902f4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.6-alpine +WORKDIR /tmp + +COPY . . +RUN adduser -S slappd && \ + pip install --upgrade . && \ + rm -rf /tmp/* + +USER slappd +ENTRYPOINT ["/usr/local/bin/slappd"] \ No newline at end of file diff --git a/README.md b/README.md index 3d25dfb..18cf337 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,17 @@ This script is designed to be run from crontab, and issues one API call per run. ### Installation & Configuration +If this is your first time, create the default config file with `make config` +and then edit it (`~/.config/slappd/slappd.cfg`) to reflect your API information +and friends list. + +#### Docker + +* Run `make docker-run` to build and run Slappd. **Note:** This mounts the + config you created earlier into the container to keep track of which check-ins + it has seen. + +#### Virtualenv + * Install Slappd to a virtualenv via `make install`. -* If this is your first time, create the default config file with `make config` - and then edit it `(~/.config/slappd/slappd.cfg)` to reflect your API information. -* Run it from crontab: `*/5 * * * ~/.virtualenv/slappd/bin/slappd > /dev/null 2>&1` +* Run it from crontab: `*/5 * * * ~/.virtualenv/slappd/bin/slappd > /dev/null 2>&1` \ No newline at end of file diff --git a/makefile b/makefile index f48eb9a..ef9ee48 100644 --- a/makefile +++ b/makefile @@ -13,6 +13,14 @@ dev: ${VIRTUALENV_DIR}/slappd pip install -U flake8 pip && \ pip install --editable . +.PHONY: docker-build +docker-build: + docker build -t slappd . + +.PHONY: docker-run +docker-run: docker-build + docker run -v ${HOME}/.config/slappd:/home/slappd/.config/slappd slappd + .PHONY: install install: ${VIRTUALENV_DIR}/slappd source ${VIRTUALENV_DIR}/slappd/bin/activate && \