1
0

🏗️」 wip: Started re work

This commit is contained in:
2025-02-07 18:00:30 +01:00
parent 0aef0328c1
commit f48c98da5a
16 changed files with 119 additions and 118 deletions

View File

@ -8,29 +8,19 @@ DOCKERFILE_DB := $(DOCKER_CONTEXT)$(DOCKER_FOLDER)/$(DB_SERVER_NAME)/Dockerfile
DOCKERFILE_WEVSRV := $(DOCKER_CONTEXT)$(DOCKER_FOLDER)/$(WEB_SERVER_NAME)/Dockerfile
DOCKERFILE_CMS := $(DOCKER_CONTEXT)$(DOCKER_FOLDER)/$(CMS_NAME)/Dockerfile
all:
dev:
docker compose --profile dev -f $(DOCKER_CONTEXT)docker-compose.yml up -d --build
prod:
docker compose -f $(DOCKER_CONTEXT)docker-compose.yml up -d --build
build-db:
docker build -f $(DOCKERFILE_DB) -t $(DB_SERVER_NAME) $(DOCKER_CONTEXT)
build-websrv:
docker build -f $(DOCKERFILE_WEVSRV) -t $(WEB_SERVER_NAME) $(DOCKER_CONTEXT)
build-cms:
docker build -f $(DOCKERFILE_CMS) -t $(CMS_NAME) $(DOCKER_CONTEXT)
start-db:
docker compose -f $(DOCKER_CONTEXT)docker-compose.yml up db --build
start-nginx:
docker compose -f $(DOCKER_CONTEXT)docker-compose.yml up nginx --build
start-wordp:
docker compose -f $(DOCKER_CONTEXT)docker-compose.yml up wordpress-php --build
all: dev
stop:
docker compose -f $(DOCKER_CONTEXT)docker-compose.yml stop
docker compose --profile dev -f $(DOCKER_CONTEXT)docker-compose.yml stop
stop-prod:
docker compose -f $(DOCKER_CONTEXT)docker-compose-prod.yml stop
clean: stop
docker system prune
@ -38,23 +28,6 @@ clean: stop
fclean: clean
docker system prune -a
clean-db:
docker stop inception-db
docker container rm inception-db
docker volume rm inception_wp-db
docker image rm inception-db
clean-wordp:
docker stop inception-wordp-php
docker container rm inception-wordp-php
docker volume rm inception_wp-site
docker image rm inception-wordpress-php
clean-nginx:
docker stop inception-nginx
docker container rm inception-nginx
docker image rm inception-nginx
re: clean all
.PHONY: cms-build db-build websrv-build clean-db clean-nginx

View File

@ -18,7 +18,7 @@ func checkMariaDB(user, password, host, port string) bool {
fmt.Printf("Health check failed: %v\n", err)
return false
}
fmt.Println("MariaDB is healthy")
fmt.Println("Maria DB is healthy")
return true
}

View File

View File

@ -1,82 +1,14 @@
name: inception
volumes:
wp-db:
wp-site:
include:
- path: ./docker/composes/nginx.yml
project_directory: ./
- path: ./docker/composes/wordp-php.yml
project_directory: ./
- path: ./docker/composes/db.yml
project_directory: ./
networks:
inception:
name: inception
external: false
services:
nginx:
container_name: inception-nginx
build:
context: .
dockerfile: docker/nginx/Dockerfile
networks:
- inception
environment:
- TZ=Europe/Paris
- NGINX_PHP_HOST=inception-wordp-php
- NGINX_SSL_KEY_FILE=/etc/nginx/ssl/adjoly-wp.key
- NGINX_SSL_CERT_FILE=/etc/nginx/ssl/adjoly-wp.crt
- NGINX_EXPOSED_HOSTS=adjoly.42.fr
depends_on:
wordpress-php:
condition: service_healthy
db:
condition: service_healthy
volumes:
- wp-site:/var/www/html
- ./configs/nginx/templates:/etc/nginx/templates
- ./configs/nginx/entry:/docker-entrypoint.d
ports:
- "10443:443"
restart: unless-stopped
labels:
- traefik.enable=true
- traefik.docker.network=traefik-back
- traefik.http.routers.inception.rule=Host(`inception.kanel.ovh`)
- traefik.http.routers.inception.entrypoints=websecure
- traefik.http.routers.inception.tls=true
- traefik.http.routers.inception.tls.certresolver=letsencrypt
- traefik.http.routers.inception.service=inception
- traefik.http.services.inception.loadbalancer.server.port=80
wordpress-php:
container_name: inception-wordp-php
build:
context: .
dockerfile: docker/wordpress/Dockerfile
networks:
- inception
depends_on:
db:
condition: service_healthy
environment:
- PHP_MEMORY_LIMIT="512M"
- PHP_MAX_UPLOAD="50M"
- PHP_PORT=9000
- TZ=Europe/Paris
volumes:
- wp-site:/var/www/html
restart: unless-stopped
db:
container_name: inception-db
build:
context: .
dockerfile: docker/mariadb/Dockerfile
networks:
- inception
environment:
- MYSQL_ROOT_PASSWORD="alpine"
- MYSQL_PASSWORD="alpine"
- MYSQL_USER="kanel"
- MYSQL_DATABASE="knl"
- TZ=Europe/Paris
volumes:
- wp-db:/var/lib/mysql
restart: unless-stopped

View File

@ -0,0 +1,20 @@
volumes:
wp-db:
services:
db:
container_name: inception-db
build:
context: .
dockerfile: docker/images/mariadb/Dockerfile
networks:
- inception
environment:
- MYSQL_ROOT_PASSWORD="alpine"
- MYSQL_PASSWORD="alpine"
- MYSQL_USER="kanel"
- MYSQL_DATABASE="knl"
- TZ=Europe/Paris
volumes:
- wp-db:/var/lib/mysql
restart: unless-stopped

View File

@ -0,0 +1,11 @@
labels:
- traefik.enable=true
- traefik.docker.network=traefik-back
- traefik.http.routers.inception.rule=Host(`inception.kanel.ovh`)
- traefik.http.routers.inception.entrypoints=websecure
- traefik.http.routers.inception.tls=true
- traefik.http.routers.inception.tls.certresolver=letsencrypt
- traefik.http.routers.inception.service=inception
- traefik.http.services.inception.loadbalancer.server.port=80

View File

@ -0,0 +1,43 @@
volumes:
nginx-templates:
name: nginx-templates
driver: local
driver_opts:
device: ./configs/nginx/templates
o: "bind,ro"
type: none
nginx-entry:
name: nginx-entry
driver: local
driver_opts:
device: ./configs/nginx/entry
o: "bind,ro"
type: none
services:
nginx:
container_name: inception-nginx
build:
context: .
dockerfile: docker/images/nginx/Dockerfile
networks:
- inception
environment:
- TZ=Europe/Paris
- NGINX_PHP_HOST=inception-wordp-php
- NGINX_SSL_KEY_FILE=/etc/nginx/ssl/adjoly-wp.key
- NGINX_SSL_CERT_FILE=/etc/nginx/ssl/adjoly-wp.crt
- NGINX_EXPOSED_HOSTS=adjoly.42.fr
depends_on:
wordpress-php:
condition: service_healthy
db:
condition: service_healthy
volumes:
- wp-site:/var/www/html
- nginx-templates:/etc/nginx/templates
- nginx-entry:/docker-entrypoint.d
ports:
- "10443:443"
restart: unless-stopped

View File

@ -0,0 +1,22 @@
volumes:
wp-site:
services:
wordpress-php:
container_name: inception-wordp-php
build:
context: .
dockerfile: docker/images/wordpress/Dockerfile
networks:
- inception
depends_on:
db:
condition: service_healthy
environment:
- PHP_MEMORY_LIMIT="512M"
- PHP_MAX_UPLOAD="50M"
- PHP_PORT=9000
- TZ=Europe/Paris
volumes:
- wp-site:/var/www/html
restart: unless-stopped

View File

@ -1,5 +1,5 @@
FROM scratch
ADD docker/alpine/alpine-minirootfs-3.21.2-x86_64.tar.gz /
ADD docker/images/alpine/alpine-minirootfs-3.21.2-x86_64.tar.gz /
LABEL version="0.1"
LABEL maintainer="KeyZox"

View File

@ -1,5 +1,5 @@
FROM scratch
ADD docker/alpine/alpine-minirootfs-3.21.2-x86_64.tar.gz /
ADD docker/images/alpine/alpine-minirootfs-3.21.2-x86_64.tar.gz /
LABEL version="0.1"
LABEL maintainer="KeyZox"
@ -28,7 +28,7 @@ RUN set -x \
VOLUME /etc/nginx/templates
VOLUME /docker-entrypoint.d
COPY docker/nginx/health.conf /etc/nginx/http.d/health.conf
COPY docker/images/nginx/health.conf /etc/nginx/http.d/health.conf
ENTRYPOINT [ "/docker-entrypoint" ]
WORKDIR /etc/nginx

View File

@ -1,5 +1,5 @@
FROM scratch
ADD docker/alpine/alpine-minirootfs-3.21.2-x86_64.tar.gz /
ADD docker/images/alpine/alpine-minirootfs-3.21.2-x86_64.tar.gz /
LABEL version="0.1"
LABEL maintainer="KeyZox"
@ -10,7 +10,7 @@ RUN set -x \
COPY go.mod /build/go.mod
COPY cmd /build/cmd
COPY internal /build/internal
COPY docker/wordpress/www-docker.conf /www-docker.conf
COPY docker/images/wordpress/www-docker.conf /www-docker.conf
RUN apk add --no-cache go curl php84-mysqli php84-fpm tzdata fcgi \
&& cd /build \