From 5d7df1fcfaffab40b42f048a5ae0ec175a948431 Mon Sep 17 00:00:00 2001 From: Ernesto Baschny Date: Fri, 7 Feb 2025 21:42:14 +0100 Subject: [PATCH 1/2] Add mysql-8.0 --- Dockerfile => Dockerfile.mariadb | 0 Dockerfile.mysql | 9 +++++ Makefile | 6 ++++ README.md | 30 +++++++++++++---- mysql.cnf | 57 ++++++++++++++++++++++++++++++++ 5 files changed, 95 insertions(+), 7 deletions(-) rename Dockerfile => Dockerfile.mariadb (100%) create mode 100644 Dockerfile.mysql create mode 100644 mysql.cnf diff --git a/Dockerfile b/Dockerfile.mariadb similarity index 100% rename from Dockerfile rename to Dockerfile.mariadb diff --git a/Dockerfile.mysql b/Dockerfile.mysql new file mode 100644 index 0000000..b14ba15 --- /dev/null +++ b/Dockerfile.mysql @@ -0,0 +1,9 @@ +# See https://hub.docker.com/_/mysql/ + +ARG MYSQL_VERSION=8.0 + +FROM mysql:${MYSQL_VERSION} + +ADD mysql.cnf /etc/mysql/conf.d/z99-docker.cnf +RUN chown mysql:mysql /etc/mysql/conf.d/z99-docker.cnf \ + && chmod 0644 /etc/mysql/conf.d/z99-docker.cnf diff --git a/Makefile b/Makefile index 2f03f55..a20903c 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ PLATFORMS=linux/arm64/v8,linux/amd64 # Defaults: MARIADB_VERSION=10.7 +MYSQL_VERSION=8.0 #BUILDX_OPTIONS=--push DOCKER_CACHE=--cache-from "type=local,src=.buildx-cache" --cache-to "type=local,dest=.buildx-cache" @@ -10,4 +11,9 @@ DOCKER_CACHE=--cache-from "type=local,src=.buildx-cache" --cache-to "type=local, build: docker buildx build $(DOCKER_CACHE) $(BUILDX_OPTIONS) \ --platform $(PLATFORMS) \ + -f Dockerfile.mariadb \ --build-arg MARIADB_VERSION=$(MARIADB_VERSION) --tag croneu/phpapp-db:mariadb-$(MARIADB_VERSION) . + docker buildx build $(DOCKER_CACHE) $(BUILDX_OPTIONS) \ + --platform $(PLATFORMS) \ + -f Dockerfile.mysql \ + --build-arg MYSQL_VERSION=$(MYSQL_VERSION) --tag croneu/phpapp-db:mysql-$(MYSQL_VERSION) . diff --git a/README.md b/README.md index 562d679..c1beb6c 100644 --- a/README.md +++ b/README.md @@ -13,19 +13,19 @@ This is the MySQL database container, with images for **amd64** and **arm64** ## Tags available * `croneu/phpapp-db:mariadb-10.7` +* `croneu/phpapp-db:mysql-8.0` -This is just a pre-configured alternative to the upstream official **MariaDB** image. This -allows us to use it straight on for TYPO3 projects without having to include any further +This is just a pre-configured alternative to the upstream official images (**MariaDB** or **MySQL**). +This allows us to use it straight on for TYPO3 projects without having to include any further configuration or do any performance tuning. -We are using MariaDB instead of the official MySQL images, because these are not available -for ARM architecture yet. - ## Settings -See upstream: https://hub.docker.com/_/mariadb +See upstream: +* https://hub.docker.com/_/mariadb +* https://hub.docker.com/_/mysql -Example `docker-compose.yaml`: +Example `docker-compose.yaml` for MariaDB: ``` mysql: @@ -41,6 +41,22 @@ Example `docker-compose.yaml`: MARIADB_PASSWORD: ${DB_PASS} ``` +Example `docker-compose.yaml` for MySQL 8.0: + +``` + mysql: + image: croneu/phpapp-db:mysql-8.0 + ports: + - 13306:3306 + volumes: + - mysql:/var/lib/mysql + environment: + MYSQL_ROOT_PASSWORD: ${DB_PASS} + MYSQL_DATABASE: ${DB_NAME} + MYSQL_USER: ${DB_USER} + MYSQL_PASSWORD: ${DB_PASS} +``` + ---- ## Docker Image Development diff --git a/mysql.cnf b/mysql.cnf new file mode 100644 index 0000000..c97b0c5 --- /dev/null +++ b/mysql.cnf @@ -0,0 +1,57 @@ +[mysqld] + +# Defaults noted here are from MySQL 8.0 (official docker image) + +################################################# +## Buffers + +# default is 8M +key_buffer_size = 128M + +# default is 128M +innodb_buffer_pool_size = 512M + +# default is 100M +innodb_redo_log_capacity = 512M + +# default is 16M +innodb_log_buffer_size = 128M + +# default is 16M +tmp_table_size = 128M + +# default is 16M +max_heap_table_size = 128M + +# default is 256k +join_buffer_size = 4M + +# default is 256k +sort_buffer_size = 4M + +# default is 128k +read_buffer_size = 1M + +# default is 256k +read_rnd_buffer_size = 1M + +################################################# +## Misc + +# default is 1 +innodb_flush_log_at_trx_commit = 0 + +# default is fsync +innodb_flush_method = O_DSYNC + +################################################# +## Connections + +# default is 151 +max_connections = 20 + +################################################# +## TYPO3 compatibility + +# default is ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION +sql_mode = "" From c152ba20638ac95c4dac913cba1fe8ec99b8e59d Mon Sep 17 00:00:00 2001 From: Ernesto Baschny Date: Fri, 7 Feb 2025 21:42:30 +0100 Subject: [PATCH 2/2] Build mariadb and mysql in GA --- .github/workflows/build-and-push.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 73b7361..9d19f69 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -10,11 +10,6 @@ jobs: build_and_push: runs-on: ubuntu-latest - strategy: - matrix: - include: - - mariadb-version: 10.7 - steps: - name: "Checkout Sourcecode" uses: actions/checkout@v2 @@ -39,17 +34,14 @@ jobs: "${{ runner.os }}-buildx-${{ matrix.mariadb-version }}-" "${{ runner.os }}-buildx-" - - name: "Docker build mariadb-${{ matrix.mariadb-version }}" - run: make build MARIADB_VERSION=${{ matrix.mariadb-version }} - - name: "Login to DockerHub" uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: "Docker push mariadb-${{ matrix.mariadb-version }}" - run: make build BUILDX_OPTIONS=--push MARIADB_VERSION=${{ matrix.mariadb-version }} + - name: "Docker build and push" + run: make build BUILDX_OPTIONS=--push - name: "Update Docker Hub Description (croneu/phpapp-db)" uses: peter-evans/dockerhub-description@v2