Skip to content

davidecavestro/dwservice-agent-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dwservice-agent-docker - A way to containerize dwservice

What’s this?

This repo provides some config and a script to package the dwservice agent into a docker image and run it.

How to use it?

Create a new agent from dwservice UI and take note of the agent code.

Copy the .env.example file into .env, updating the AGENT_CODE variable and adding the packages you need into the container.

Adapt the docker-compose.yml entries as per your needs (i.e. use privileged: true, network_mode: "host", set a restart_policy).

Finally run docker-compose build && docker-compose up.

How does it work?

  • the config folder is mounted into the container at /config path

  • the entrypoint.sh script looks for a file named /config/config.json

  • if doesn’t exist or is not valid, the entrypoint launches the config generation routine passing the agent code obtained from the AGENT_CODE environment variable

  • the entrypoint creates at /app/core/config.json a symlink pointing to /config/config.json

  • the entrypoint launches the agent

Container side

Relevant files as seen within the container

/
├── config
│   └── config.json                            # 2. config file generated by dwservice
└── app
    ├── core
    │   ├── agent.py                           # 4. agent launch routine
    │   ├── config.json -> /config/config.json # 3. link to config file
    │   └── ...
    ├── make
    │   ├── create_config.py                   # 1. config generation routine
    │   └── ...
    └── ...

Host side

Relevant files as seen from the host

.
├── config
│   └── config.json     # config file generated by dwservice
├── .env                # your config
├── docker-compose.yml
├── Dockerfile
├── entrypoint.sh
└── ...

License

This software is released under the MIT License.

All trademarks and product names are the property of their respective owners.