Split docker-compose

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
This commit is contained in:
Bensuperpc 2023-03-17 22:38:48 +01:00
parent cf07b3d1fa
commit 4beed39731
No known key found for this signature in database
GPG Key ID: D00C6B1021747EED
6 changed files with 141 additions and 137 deletions

View File

@ -9,7 +9,7 @@
#// // #// //
#// Script, 2022 // #// Script, 2022 //
#// Created: 14, April, 2022 // #// Created: 14, April, 2022 //
#// Modified: 19, June, 2022 // #// Modified: 17, March, 2023 //
#// file: - // #// file: - //
#// - // #// - //
#// Source: // #// Source: //
@ -20,57 +20,56 @@
DOCKER := docker DOCKER := docker
PROFILE := wp_db wordpress webserver certbot phpmyadmin flask_website flask_db pgadmin qbittorrent jellyfin PROFILES := wp_db wordpress webserver certbot phpmyadmin flask_website flask_db pgadmin qbittorrent jellyfin
PROFILE_CMD := $(addprefix --profile ,$(PROFILE)) PROFILE_CMD := $(addprefix --profile ,$(PROFILES))
COMPOSE_FILE := docker-compose.yml
COMPOSE_FILES := $(shell find docker-compose* | sed -e 's/^/--file /')
AUTHOR := bensuperpc AUTHOR := bensuperpc
IMAGE_NAME := wordpress:6.1.1-php8.1-fpm mariadb:10.10.2 nginx:1.23 certbot/certbot:v1.32.0 phpmyadmin:5.2.0 dpage/pgadmin4:6.16 lscr.io/linuxserver/qbittorrent:latest \
lscr.io/linuxserver/jellyfin:latest
#IMAGE_AUTHOR := $(addprefix itzg/, $(IMAGE_NAME))
#IMAGE_FULL_NAME := $(addsuffix :latest, $(IMAGE_AUTHOR))
.PHONY: build all .PHONY: build all
all: start all: start
.PHONY: build .PHONY: build
build: build:
docker-compose -f $(COMPOSE_FILE) $(PROFILE_CMD) build docker compose $(COMPOSE_FILES) $(PROFILE_CMD) build
.PHONY: start .PHONY: start
start: start:
docker-compose -f $(COMPOSE_FILE) $(PROFILE_CMD) up -d docker compose $(COMPOSE_FILES) $(PROFILE_CMD) up -d
.PHONY: start-at
start-at: start-at:
docker-compose -f $(COMPOSE_FILE) $(PROFILE_CMD) up docker compose $(COMPOSE_FILES) $(PROFILE_CMD) up
.PHONY: docker-check
docker-check:
docker compose $(COMPOSE_FILES) $(PROFILES_CMD) config
.PHONY: stop .PHONY: stop
stop: down stop: down
.PHONY: down .PHONY: down
down: down:
docker-compose -f $(COMPOSE_FILE) $(PROFILE_CMD) down docker compose $(COMPOSE_FILES) $(PROFILE_CMD) down
.PHONY: restart .PHONY: restart
restart: stop start restart: stop start
.PHONY: logs .PHONY: logs
logs: logs:
docker-compose -f $(COMPOSE_FILE) logs docker compose $(COMPOSE_FILES) logs
.PHONY: state .PHONY: state
state: state:
docker-compose -f $(COMPOSE_FILE) ps docker compose $(COMPOSE_FILES) ps
docker-compose -f $(COMPOSE_FILE) top docker compose $(COMPOSE_FILES) top
.PHONY: update .PHONY: update
update: update:
git pull --recurse-submodules --all --progress git pull --recurse-submodules --all --progress
echo $(IMAGE_NAME) | xargs -n1 docker pull docker compose $(COMPOSE_FILES) $(PROFILES_CMD) pull
.PHONY: clean .PHONY: clean
clean: clean:
@ -78,4 +77,4 @@ clean:
.PHONY: purge .PHONY: purge
purge: purge:
docker-compose -f $(COMPOSE_FILE) $(PROFILE_CMD) down -v --rmi all docker compose $(COMPOSE_FILES) $(PROFILE_CMD) down -v --rmi all

47
docker-compose.flask.yml Normal file
View File

@ -0,0 +1,47 @@
version: "3.9"
services:
flask_website:
build:
context: ./bensuperpc_website
dockerfile: Dockerfile
container_name: flask_website
profiles:
- flask_website
depends_on:
- flask_db
volumes:
- ./bensuperpc_website:/app:rw
env_file:
- env/flask_website.env
restart: unless-stopped
ports:
- 5000:5000
networks:
- app-network
flask_db:
image: postgres:latest
container_name: flask_db
profiles:
- flask_db
restart: unless-stopped
env_file:
- env/flask_database.env
# ports:
# - 5432:5432
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- app-network
pgadmin:
container_name: pgadmin_container
image: dpage/pgadmin4:6.16
profiles:
- pgadmin
restart: unless-stopped
env_file:
- env/pgadmin.env
depends_on:
- flask_db
networks:
- app-network

View File

@ -0,0 +1,6 @@
version: "3.9"
networks:
app-network:
driver: bridge
name: app-network

23
docker-compose.volume.yml Normal file
View File

@ -0,0 +1,23 @@
version: "3.9"
volumes:
certbot-cert:
name: certbot-cert
wordpress:
name: wordpress
dbdata:
name: dbdata
qbittorrent-downloads:
name: qbittorrent-downloads
qbittorrent-conf:
name: qbittorrent-conf
jellyfin-config:
name: jellyfin-config
jellyfin-tvseries:
name: jellyfin-tvseries
jellyfin-movies:
name: jellyfin-movies
jellyfin:
name: jellyfin
postgres-data:
name: postgres-data

View File

@ -0,0 +1,46 @@
version: "3.9"
services:
wp_db:
image: mariadb:10.10.2
container_name: wp_db
profiles:
- wp_db
restart: unless-stopped
env_file:
- env/wp_database.env
volumes:
- dbdata:/var/lib/mysql
networks:
- app-network
wordpress:
depends_on:
- wp_db
image: wordpress:6.1.1-php8.1-fpm
container_name: wordpress
profiles:
- wordpress
restart: unless-stopped
env_file:
- env/wordpress.env
# environment:
# - WORDPRESS_DB_HOST=wp_db:3306
volumes:
- wordpress:/var/www/html
networks:
- app-network
phpmyadmin:
image: phpmyadmin:5.2.0
container_name: phpmyadmin
profiles:
- phpmyadmin
restart: unless-stopped
env_file:
- env/phpmyadmin.env
# ports:
# - 8080:80
depends_on:
- wp_db
networks:
- app-network

View File

@ -19,68 +19,6 @@ services:
- certbot-cert:/etc/letsencrypt:ro - certbot-cert:/etc/letsencrypt:ro
networks: networks:
- app-network - app-network
wp_db:
image: mariadb:10.10.2
container_name: wp_db
profiles:
- wp_db
restart: unless-stopped
env_file:
- env/wp_database.env
volumes:
- dbdata:/var/lib/mysql
networks:
- app-network
wordpress:
depends_on:
- wp_db
image: wordpress:6.1.1-php8.1-fpm
container_name: wordpress
profiles:
- wordpress
restart: unless-stopped
env_file:
- env/wordpress.env
# environment:
# - WORDPRESS_DB_HOST=wp_db:3306
volumes:
- wordpress:/var/www/html
networks:
- app-network
flask_website:
build:
context: ./bensuperpc_website
dockerfile: Dockerfile
container_name: flask_website
profiles:
- flask_website
depends_on:
- flask_db
volumes:
- ./bensuperpc_website:/app:rw
env_file:
- env/flask_website.env
restart: unless-stopped
ports:
- 5000:5000
networks:
- app-network
flask_db:
image: postgres:latest
container_name: flask_db
profiles:
- flask_db
restart: unless-stopped
env_file:
- env/flask_database.env
# ports:
# - 5432:5432
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- app-network
qbittorrent: qbittorrent:
image: lscr.io/linuxserver/qbittorrent:latest image: lscr.io/linuxserver/qbittorrent:latest
container_name: qbittorrent container_name: qbittorrent
@ -141,58 +79,3 @@ services:
--webroot-path=/app --domain bensuperpc.org --domain www.bensuperpc.org \ --webroot-path=/app --domain bensuperpc.org --domain www.bensuperpc.org \
--webroot-path=/var/www/jellyfin --domain jellyfin.bensuperpc.org --domain www.jellyfin.bensuperpc.org \ --webroot-path=/var/www/jellyfin --domain jellyfin.bensuperpc.org --domain www.jellyfin.bensuperpc.org \
--webroot-path=/var/www/wordpress --domain wordpress.bensuperpc.org --domain www.wordpress.bensuperpc.org --webroot-path=/var/www/wordpress --domain wordpress.bensuperpc.org --domain www.wordpress.bensuperpc.org
phpmyadmin:
image: phpmyadmin:5.2.0
container_name: phpmyadmin
profiles:
- phpmyadmin
restart: unless-stopped
env_file:
- env/phpmyadmin.env
# ports:
# - 8080:80
depends_on:
- wp_db
networks:
- app-network
pgadmin:
container_name: pgadmin_container
image: dpage/pgadmin4:6.16
profiles:
- pgadmin
restart: unless-stopped
env_file:
- env/pgadmin.env
depends_on:
- flask_db
networks:
- app-network
volumes:
certbot-cert:
name: certbot-cert
wordpress:
name: wordpress
dbdata:
name: dbdata
qbittorrent-downloads:
name: qbittorrent-downloads
qbittorrent-conf:
name: qbittorrent-conf
jellyfin-config:
name: jellyfin-config
jellyfin-tvseries:
name: jellyfin-tvseries
jellyfin-movies:
name: jellyfin-movies
jellyfin:
name: jellyfin
postgres-data:
name: postgres-data
networks:
app-network:
driver: bridge
name: app-network