Fix Portainer file mounts
This commit is contained in:
@@ -149,6 +149,11 @@ Expected exposed ports:
|
||||
PostgreSQL is intentionally not exposed by default in the Compose file. It is
|
||||
only reachable by the backend on the internal Docker network.
|
||||
|
||||
The stack builds small local images for `database` and `mqtt` so Portainer does
|
||||
not need to bind-mount individual files like `database/init.sql` or
|
||||
`mqtt/mosquitto.conf`. This avoids file-versus-directory mount errors in
|
||||
Portainer Git stacks.
|
||||
|
||||
### 4. Verify
|
||||
|
||||
Open:
|
||||
|
||||
4
database/Dockerfile
Normal file
4
database/Dockerfile
Normal file
@@ -0,0 +1,4 @@
|
||||
FROM postgres:16-alpine
|
||||
|
||||
COPY init.sql /docker-entrypoint-initdb.d/01-init.sql
|
||||
COPY seed.sql /docker-entrypoint-initdb.d/02-seed.sql
|
||||
@@ -1,14 +1,13 @@
|
||||
services:
|
||||
database:
|
||||
image: postgres:16-alpine
|
||||
build:
|
||||
context: ./database
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB:-plasttrack}
|
||||
POSTGRES_USER: ${POSTGRES_USER:-plasttrack}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-plasttrack}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./database/init.sql:/docker-entrypoint-initdb.d/01-init.sql:ro
|
||||
- ./database/seed.sql:/docker-entrypoint-initdb.d/02-seed.sql:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
|
||||
interval: 5s
|
||||
@@ -16,12 +15,11 @@ services:
|
||||
retries: 20
|
||||
|
||||
mqtt:
|
||||
image: eclipse-mosquitto:2
|
||||
build:
|
||||
context: ./mqtt
|
||||
ports:
|
||||
- "1883:1883"
|
||||
- "9001:9001"
|
||||
volumes:
|
||||
- ./mqtt/mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "mosquitto_sub -h localhost -p 1883 -t '$$SYS/broker/version' -C 1 -W 3 >/dev/null 2>&1"]
|
||||
interval: 10s
|
||||
|
||||
3
mqtt/Dockerfile
Normal file
3
mqtt/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM eclipse-mosquitto:2
|
||||
|
||||
COPY mosquitto.conf /mosquitto/config/mosquitto.conf
|
||||
Reference in New Issue
Block a user