Custom worker - Docker-based
Build the Docker image
Build the image or consume it from the Dockerhub repository:
Image build:
- Filter worker:
docker build --target filter -f docker/Dockerfile . -t artemis-custom-worker-filter:latest
- Utility worker:
docker build --target utility -f docker/Dockerfile . -t artemis-custom-worker-utility:latest
- Optimiser worker:
docker build --target optimiser -f docker/Dockerfile . -t artemis-custom-worker-optimiser:latest
Execution from Dockerhub:
docker pull artemis-custom-worker-filter:latest
docker pull artemis-custom-worker-utility:latest
docker pull artemis-custom-worker-optimiser:latest
Configure the Docker image
Once the image is available on your local machine, ensure that the image configuration is the following. The image can only be used with the specified configuration.
Environment variables:
-
ARTEMIS_WORKER_SUFFIX: the worker suffix to apply, it needs to match what is configured on the Artemis UI. Please see: Custom worker suffix
-
Volume or secret map for environment credentials: The container requires the file .env.credentials to be provided as a volume map in the following location "/app/.env.credentials".
The format of the file is as follows:
ARTEMIS_USERNAME="<your artemis username>"
ARTEMIS_PASSWORD="<your artemis password>"
ARTEMIS_TARGET_ENVIRONMENT=custom|development|staging|production
Run the container
The custom Artemis worker is provided in a range of base images, so base support suits a variety of use-cases and scenarios. Depending on the technology of the project to be used, selection of the base image is relevant.
Image name | software |
---|---|
artemis-custom-worker:filter-python-latest | python + bash |
artemis-custom-worker:utility-python-latest | python + bash |
artemis-custom-worker:optimiser-python-latest | python + bash |
artemis-custom-worker:filter-bash-latest | bash |
artemis-custom-worker:utility-bash-latest | bash |
artemis-custom-worker:optimiser-bash-latest | bash |
You can run the container explicitly using docker or arrange the execution using docker compose so volume management and environment configuration is easier.
Option 1: Run container using plain docker
- Filter worker:
docker run -v /location/of/file/.env.credentials:/app/.env.credentials -e WORKER_SUFFIX="my-worker-suffix" artemis-custom-worker:filter-python-latest
- Utility worker:
docker run -v /location/of/file/.env.credentials:/app/.env.credentials -e WORKER_SUFFIX="my-worker-suffix" artemis-custom-worker:utility-python-latest
- Optimiser worker:
docker run -v /location/of/file/.env.credentials:/app/.env.credentials -e WORKER_SUFFIX="my-worker-suffix" artemis-custom-worker:optimiser-python-latest
Option 2: Run container using docker compose:
version: '3'
services:
artemis-custom-worker-filter:
image: artemis-custom-worker:filter-python-latest
container_name: artemis-custom-worker
hostname: artemis-custom-worker
build:
dockerfile: ./Dockerfile
context: ./../
target: filter
environment:
ARTEMIS_WORKER_SUFFIX: my-suffix
volumes:
- ./../.env.credentials:/app/.env.credentials
artemis-custom-worker-utility:
image: artemis-custom-worker:utility-python-latest
container_name: artemis-custom-worker
hostname: artemis-custom-worker
build:
dockerfile: ./Dockerfile
context: ./../
target: utility
environment:
ARTEMIS_WORKER_SUFFIX: my-suffix
volumes:
- ./../.env.credentials:/app/.env.credentials
artemis-custom-worker-optimiser:
image: artemis-custom-worker:optimiser-python-latest
container_name: artemis-custom-worker
hostname: artemis-custom-worker
build:
dockerfile: ./Dockerfile
context: ./../
target: optimiser
environment:
ARTEMIS_WORKER_SUFFIX: my-suffix
volumes:
- ./../.env.credentials:/app/.env.credentials