wordpress-dev/production/deploy-to-container.sh

53 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
_docker_service_name="blog"
_mysql_root_passwd="dklfm904mg-uiojn"
_wordpress_tag="latest"
_mariadb_tag="10.5"
_site_domain="blog.wptest.isnet.uk"
echo "
version: \"3\"
networks:
web:
external: true
internal:
external: false
services:
# TODO this needs to be just an apache or php container or whatever with a persistent
# html volume
$_docker_service_name:
image: wordpress:$_wordpress_tag
container_name: $_docker_service_name
environment:
WORDPRESS_DB_PASSWORD: $_mysql_root_passwd
labels:
- \"traefik.enable=true\"
- \"traefik.http.routers.$_docker_service_name.entrypoints=http\"
- \"traefik.http.routers.$_docker_service_name.rule=Host(\`$_site_domain\`)\"
- \"traefik.http.middlewares.$_docker_service_name.redirectscheme.scheme=https\"
- \"traefik.http.routers.$_docker_service_name.middlewares=$_docker_service_name\"
- \"traefik.http.routers.$_docker_service_name.entrypoints=https\"
- \"traefik.http.routers.$_docker_service_name.rule=Host(\`$_site_domain\`)\"
- \"traefik.http.routers.$_docker_service_name.tls=true\"
- \"traefik.http.routers.$_docker_service_name.tls.certresolver=http\"
- \"traefik.http.services.$_docker_service_name.loadbalancer.server.port=80\"
- \"traefik.http.routers.$_docker_service_name.service=$_docker_service_name\"
- \"traefik.docker.network=web\"
networks:
- internal
- web
depends_on:
- mysql
mariadb:
image: mariadb:$_mariadb_tag
environment:
MYSQL_ROOT_PASSWORD: $_mysql_root_passwd
networks:
- internal
labels:
- traefik.enable=false
" > docker-compose.yml