Skip to content

Commit

Permalink
Add Docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristensen committed Apr 26, 2018
1 parent ca790c4 commit 8bb1d8f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
8 changes: 8 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down

0 comments on commit 8bb1d8f

Please sign in to comment.