50 lines
1.1 KiB
YAML
50 lines
1.1 KiB
YAML
version: "3.8"
|
|
|
|
services:
|
|
server:
|
|
build:
|
|
context: ..
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8080:8080"
|
|
environment:
|
|
- SERVER_ADDRESS=0.0.0.0
|
|
- SERVER_PORT=8080
|
|
- JWT_SECRET=secret
|
|
- MQTT_BROKER=tcp://mosquitto:1883
|
|
- MQTT_CLIENT_ID=lambdaiot-server
|
|
- MQTT_TOPIC=lambdaiot
|
|
depends_on:
|
|
- mosquitto
|
|
# server image now waits for MQTT broker itself via entrypoint
|
|
# no command override needed
|
|
|
|
mosquitto:
|
|
image: eclipse-mosquitto:2.0
|
|
ports:
|
|
- "1883:1883"
|
|
volumes:
|
|
- mosquitto_data:/mosquitto/data
|
|
- mosquitto_log:/mosquitto/log
|
|
healthcheck:
|
|
test: ["CMD", "sh", "-c", "nc -z localhost 1883 || exit 1"]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 10
|
|
|
|
subscriber:
|
|
image: python:3.11-slim
|
|
volumes:
|
|
- ./subscribe.py:/app/subscribe.py
|
|
working_dir: /app
|
|
environment:
|
|
- MQTT_BROKER=mosquitto:1883
|
|
- MQTT_TOPIC=lambdaiot
|
|
command: sh -c "pip install paho-mqtt && python subscribe.py"
|
|
depends_on:
|
|
- mosquitto
|
|
|
|
volumes:
|
|
mosquitto_data:
|
|
mosquitto_log:
|