chore: layout changes

This commit is contained in:
sujiba 2024-05-07 00:42:02 +02:00
parent e615c1819e
commit 83091962a2
6 changed files with 78 additions and 15 deletions

View file

@ -1,2 +1,19 @@
# docker-compose
- [docker-compose](#docker-compose)
- [Directory structure](#directory-structure)
## Directory structure
```
/opt/docker
.
├── container-update.sh
├── example_stack
│   ├── docker-compose.yml
│   └── volumes
└── example_app
   ├── docker-compose.yml
   ├── docker-compose.yml_bak
   └── volumes
```

31
container-update.sh Normal file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -e
for compose_file in /opt/docker/**/docker-compose.yml; do
if [[ $(docker compose -f "$compose_file" ps -q) ]]; then
echo "> Updating $compose_file"
docker compose -f "$compose_file" pull
docker compose -f "$compose_file" up -d --remove-orphans
echo ""
else
echo "> Skipping $compose_file as it's not running."
echo ""
fi
done
echo "> Containers have been updated."
echo ""
confirm=n
read -p "> Do you want to remove all dangling images? [y/N]" confirm
echo ""
if [[ $confirm == [yY] ]]; then
docker image prune -f -a
echo "> All dangling images have been removed."
else
echo "> Dangling images haven't been removed."
fi
exit

View file

@ -17,7 +17,7 @@ services:
group_add:
- dialout
ports:
- 127.0.0.1:38080:8080
- "127.0.0.1:38080:8080"
volumes:
- ./volumes/zigbee2mqtt/data:/app/data
- /run/udev:/run/udev:ro
@ -33,7 +33,7 @@ services:
container_name: mqtt
command: "mosquitto -c /mosquitto-no-auth.conf"
ports:
- 127.0.0.1:1883:1883
- "127.0.0.1:1883:1883"
volumes:
- ./volumes/mosquitto/conf:/mosquitto/conf
- ./volumes/mosquitto/data:/mosquitto/data

View file

@ -8,7 +8,7 @@ services:
PGID: 1001
TZ: Europe/Berlin
ports:
- 127.0.0.1:13000:3000
- "127.0.0.1:13000:3000"
volumes:
- ./volumes/config:/app/config
- ./volumes/icons:/app/public/icons

View file

@ -4,9 +4,6 @@ services:
image: mariadb:10.5
container_name: nc_db
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: unless-stopped
volumes:
- ./volumes/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=Subatomic-Lapping0-Untagged-Deceptive-Judge
- MARIADB_AUTO_UPGRADE=1
@ -14,6 +11,9 @@ services:
env_file:
- mariadb.env
- nextcloud.env
volumes:
- ./volumes/db:/var/lib/mysql
restart: unless-stopped
nc_redis:
image: redis:alpine
@ -23,11 +23,6 @@ services:
nc_app:
image: nextcloud:apache
container_name: nc_app
restart: unless-stopped
volumes:
- ./volumes/nextcloud:/var/www/html
ports:
- "127.0.0.1:28080:80"
environment:
- MYSQL_HOST=nc_db
- REDIS_HOST=nc_redis
@ -38,18 +33,22 @@ services:
- PHP_UPLOAD_LIMIT=1G
env_file:
- nextcloud.env
ports:
- "127.0.0.1:28080:80"
volumes:
- ./volumes/nextcloud:/var/www/html
depends_on:
- nc_db
- nc_redis
restart: unless-stopped
nc_cron:
image: nextcloud:apache
container_name: nc_cron
restart: unless-stopped
volumes:
- ./volumes/nextcloud:/var/www/html
entrypoint: /cron.sh
depends_on:
- nc_db
- nc_redis
54,1 Bot
restart: unless-stopped

View file

@ -1,12 +1,28 @@
---
name: app_stack
services:
service_name:
foo:
image:
container_name:
command:
environment:
env_file:
command:
ports:
volumes:
depends_on:
restart: unless-stopped
bar:
image: bar/bar:latest
container_name: bar
command:
environment:
- TZ=Europe/Berlin
env_file:
ports:
- "127.0.0.1:443:443"
volumes:
- ./volumes/bar:/bar
depends_on:
- foo
restart: unless-stopped