From e0677a1d2c819bca695e4a9fc4e169e837dcf39e Mon Sep 17 00:00:00 2001 From: Sergey Voloshin Date: Wed, 24 Jan 2024 23:11:40 +0300 Subject: [PATCH] feat(app): add MariaDB container Refs: DL-T-96 --- config-files/docker-compose-mariadb.yaml | 15 +++++++++++++++ project/env.go | 4 ++++ 2 files changed, 19 insertions(+) create mode 100644 config-files/docker-compose-mariadb.yaml diff --git a/config-files/docker-compose-mariadb.yaml b/config-files/docker-compose-mariadb.yaml new file mode 100644 index 0000000..edfa17a --- /dev/null +++ b/config-files/docker-compose-mariadb.yaml @@ -0,0 +1,15 @@ +version: "3.8" + +services: + db: + container_name: ${HOST_NAME}_db + image: mariadb:${MARIADB_VERSION:-lts} + command: --innodb_strict_mode=off --innodb_flush_log_at_trx_commit=2 --transaction-isolation=READ-COMMITTED --sql_mode= + environment: + - "MYSQL_DATABASE=${MYSQL_DATABASE:-db}" + - "MYSQL_USER=${MYSQL_USER:-db}" + - "MYSQL_PASSWORD=${MYSQL_PASSWORD:-db}" + - "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}" + - "TZ=${TZ:-Europe/Moscow}" + volumes: + - "${PWD}/.docker/volume/mariadb/:/var/lib/mysql/:delegated" diff --git a/project/env.go b/project/env.go index 9c78c64..11ea703 100644 --- a/project/env.go +++ b/project/env.go @@ -111,6 +111,7 @@ func setComposeFiles() { images := map[string]string{ "mysql": templateDir + "/docker-compose-mysql.yaml", + "mariadb": templateDir + "/docker-compose-mariadb.yaml", "pgsql": templateDir + "/docker-compose-pgsql.yaml", "fpm": templateDir + "/docker-compose-fpm.yaml", "apache": templateDir + "/docker-compose-apache.yaml", @@ -131,6 +132,9 @@ func setComposeFiles() { if Env.GetFloat64("MYSQL_VERSION") > 0 { files = append(files, images["mysql"]) } + if Env.GetFloat64("MARIADB_VERSION") > 0 { + files = append(files, images["mariadb"]) + } if Env.GetFloat64("POSTGRES_VERSION") > 0 { files = append(files, images["pgsql"]) }