Skip to content

Commit 2af23a3

Browse files
committed
fix: pkg: Read-only docker image (fixes #4).
Ensure all PID files are placed in `/tmp`. Provide an example `docker-compose.yaml` demonstrating how to deploy workers as read-only images with `tmpfs` volume mounted to `/tmp`.
1 parent 7da30e1 commit 2af23a3

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

docker/docker-compose.yaml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,38 @@ services:
1919
ms_graph_exporter_beat:
2020
build:
2121
context: ../
22-
dockerfile: docker/MsGraphExporter.Dockerfile
23-
image: msgraphexporter:0.1.0-rc0
22+
dockerfile: docker/Dockerfile
23+
image: msgraphexporter:0.1.0-rc.1
2424
command: ["msgraphexporter", "--beat"]
2525
depends_on:
2626
- redis
2727
environment:
2828
CELERY_BROKER_URL: redis://redis:6379/0
2929
CELERY_BEAT_LOG_LEVEL: WARN
30+
read_only: true
31+
volumes:
32+
- type: tmpfs
33+
target: /tmp
34+
tmpfs:
35+
size: 1000000 # 1MB
3036

3137
ms_graph_exporter_map:
32-
image: msgraphexporter:0.1.0-rc0
38+
image: msgraphexporter:0.1.0-rc.1
3339
command: ["msgraphexporter", "--map"]
3440
depends_on:
3541
- ms_graph_exporter_beat
3642
environment:
3743
CELERY_BROKER_URL: redis://redis:6379/0
3844
CELERY_WORKER_LOG_LEVEL: WARN
45+
read_only: true
46+
volumes:
47+
- type: tmpfs
48+
target: /tmp
49+
tmpfs:
50+
size: 1000000 # 1MB
3951

4052
ms_graph_exporter_fetch:
41-
image: msgraphexporter:0.1.0-rc0
53+
image: msgraphexporter:0.1.0-rc.1
4254
command: ["msgraphexporter", "--fetch"]
4355
depends_on:
4456
- ms_graph_exporter_beat
@@ -48,12 +60,28 @@ services:
4860
GRAPH_TENANT: ${GRAPH_TENANT}
4961
GRAPH_CLIENT_ID: ${GRAPH_CLIENT_ID}
5062
GRAPH_CLIENT_SECRET: ${GRAPH_CLIENT_SECRET}
63+
read_only: true
64+
volumes:
65+
- type: tmpfs
66+
target: /tmp
67+
tmpfs:
68+
size: 1000000 # 1MB
5169

5270
ms_graph_exporter_store:
53-
image: msgraphexporter:0.1.0-rc0
71+
build:
72+
context: ../
73+
dockerfile: docker/Dockerfile
74+
image: msgraphexporter:0.1.0-rc.1
5475
command: ["msgraphexporter", "--store"]
5576
depends_on:
5677
- ms_graph_exporter_beat
5778
environment:
5879
CELERY_BROKER_URL: redis://redis:6379/0
5980
CELERY_WORKER_LOG_LEVEL: WARN
81+
GRAPH_REDIS_URL: redis://redis:6379/0
82+
read_only: true
83+
volumes:
84+
- type: tmpfs
85+
target: /tmp
86+
tmpfs:
87+
size: 1000000 # 1MB

docker/supervisord.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
nodaemon=true
33
logfile=/dev/null
44
logfile_maxbytes=0
5+
pidfile=/tmp/supervisord.pid
56

67
[program:beat]
78
autorestart=true

0 commit comments

Comments
 (0)