Add MySQL config (#2)

This commit is contained in:
hygienic-books 2023-01-12 15:58:11 +01:00
parent ed7bd9c5f0
commit c2ae0e92c3
7 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,14 @@
# For the remainder of this Dockerfile EXAMPLE_ARG_FOR_DOCKERFILE will be
# available with a value of 'must_be_available_in_dockerfile', check out the env
# file at 'env/fully.qualified.domain.name.example' for reference.
# ARG EXAMPLE_ARG_FOR_DOCKERFILE
# Another env var, this one's needed in the example build step below:
# ARG MYSQL_VERSION
# Example
# FROM "mysql:${MYSQL_VERSION}"
# RUN apt-get update && \
# apt-get -y install \
# somepackage-6.q16-6-extra && \
# rm -rf /var/lib/apt/lists/*

View File

View File

11
mysql/common-settings.yml Normal file
View File

@ -0,0 +1,11 @@
services:
common-settings:
environment:
TZ: "${TIMEZONE:-Etc/UTC}"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "10"
compress: "true"
restart: "${RESTARTPOLICY:-unless-stopped}"

View File

@ -0,0 +1,9 @@
services:
mysql-build:
image: "mysql/mysql-server:${MYSQL_VERSION}"
profiles: ["build"]
build:
context: "build-context/mysql"
dockerfile: Dockerfile
args:
MYSQL_VERSION: "${MYSQL_VERSION}"

27
mysql/docker-compose.yml Normal file
View File

@ -0,0 +1,27 @@
services:
mysql:
image: "mysql/mysql-server:${MYSQL_VERSION}"
container_name: "mysql-${CONTEXT}"
networks:
mysql-default:
extends:
file: common-settings.yml
service: common-settings
ports:
- 3306:3306
volumes:
- /opt/docker-data/mysql-${CONTEXT}/data:/var/lib/mysql
- /opt/docker-data/mysql-${CONTEXT}/config/my.cnf:/etc/my.cnf
environment:
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
networks:
mysql-default:
name: mysql-${CONTEXT}
driver: bridge
driver_opts:
com.docker.network.enable_ipv6: "false"
ipam:
driver: default
config:
- subnet: 172.16.7.0/24

View File

@ -0,0 +1,29 @@
CONTEXT=loft_ent
# Set something sensible here and uncomment
# ---
# MYSQL_VERSION=x.y.z
# A ${LOCATION} var is usually not needed. It may be helpful when a ${CONTEXT}
# extends over more than one location e.g. to bind-mount location-specific
# config files or certificates into a container.
# ---
# LOCATION=
# Feel free to leave defaults. They apply while these vars are commented out
# ---
# RESTARTPOLICY=unless-stopped
# TIMEZONE=Etc/UTC
# See 'docker-compose.override.yml' for how to make a variable available in
# a Dockerfile
# ---
# EXAMPLE_ARG_FROM_ENV_FILE=must_be_available_in_dockerfile