-
Notifications
You must be signed in to change notification settings - Fork 190
/
Copy pathdocker-compose.yml
35 lines (34 loc) · 1.24 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Run this with: docker compose up --exit-code-from sleep1
services:
sleep1:
image: &alpine alpine:3.21.3
command: sleep ${SLEEP_FOR:-15}
environment:
OUTPUT_FILE: ${EXEC_OUTPUT_FILE:-sleep.txt}
volumes:
- &output_mount ${OUTPUT_DIR:-/tmp/${COMPOSE_PROJECT_NAME}}/:/tmp
labels:
ofelia.enabled: "true"
ofelia.job-exec.my-exec-job.schedule: &schedule ${SCHEDULE:-@every 5s}
ofelia.job-exec.my-exec-job.command: &cmd_date_tee /bin/sh -c 'date | tee -a /tmp/$${OUTPUT_FILE}'"
ofelia:
build:
dockerfile: Dockerfile
context: ../../.
depends_on:
- sleep1
command: daemon --docker
environment:
OUTPUT_FILE: ${LOCAL_EXEC_OUTPUT_FILE:-ofelia.txt}
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- *output_mount
labels:
ofelia.save-folder: "/tmp/"
ofelia.job-local.my-local-job.schedule: *schedule
ofelia.job-local.my-local-job.command: *cmd_date_tee
ofelia.job-run.my-run-job.schedule: *schedule
ofelia.job-run.my-run-job.command: *cmd_date_tee
ofelia.job-run.my-run-job.image: *alpine
ofelia.job-run.my-run-job.volume: *output_mount
ofelia.job-run.my-run-job.environment: OUTPUT_FILE=${RUN_OUTPUT_FILE:-run.txt}