Skip to content

Commit

Permalink
Merge pull request #4 from StealthyLoner/dev
Browse files Browse the repository at this point in the history
Add Dockerfile
  • Loading branch information
jjonek committed Aug 31, 2015
2 parents 7914234 + b255fb4 commit ccf37bb
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:3.4

# Run as non-root, eventually
RUN groupadd -r slamon && useradd -r -g slamon slamon

# Install SLAMon Python Agent
ADD . /workspace
WORKDIR /workspace
RUN pip install .
RUN rm -rf /workspace

# Change to a non-root user
USER slamon

CMD ["sh", "-c", "slamon-agent -u ${AFM} -l ${HANDLERS} ${EXTRA_FLAGS}"]
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,43 @@ def wait_task_handler(input_params):
return {'time': timeout}
```

Docker images
-------------

Pre-existing images are built from `master` and `dev` branches:
`slamon/agent:stable` and `slamon/agent:latest` respectively, and also
from GitHub tags as `slamon/agent:<tag>`.

### Using the images

The image offers an entrypoint that requires two environment values to
be defined: `AFM` and `HANDLERS` (Note: The handlers are not generally
required but since the agent is useless without them, it is required
here). There also exists an `EXTRA_FLAGS` environment variable that can
be used to add f.ex. verbosity flags.

If you want to override how `slamon-agent` is started, you need to
redefine the `CMD` verb.

#### With Docker Compose

The following snippet can be used:

```yml
agent:
image: slamon/agent:stable
environment:
AFM: "http://slamon-afm"
HANDLERS: "slamon_agent.handlers"
EXTRA_FLAGS: "-v"
```


[license]: https://img.shields.io/:license-Apache%20License%20v2.0-blue.svg
[ci_status]: https://travis-ci.org/SLAMon/slamon-python-agent.svg?branch=master
[coveralls]: https://coveralls.io/repos/SLAMon/slamon-python-agent/badge.svg?branch=master&service=github
[codehealth]: https://landscape.io/github/SLAMon/slamon-python-agent/master/landscape.svg?style=flat
[latest_version]: https://badge.fury.io/py/slamon-agent.svg
[pypi]: https://pypi.python.org/pypi/slamon-agent/
[requirements_img]: https://requires.io/github/SLAMon/slamon-python-agent/requirements.svg?branch=master
[requirements]: https://requires.io/github/SLAMon/slamon-python-agent/requirements/?branch=master
[requirements]: https://requires.io/github/SLAMon/slamon-python-agent/requirements/?branch=master

0 comments on commit ccf37bb

Please sign in to comment.