Usually, MariaDB uses data directory specified as a Docker volume that is mounted onto host: this allows retaining data after container restarts.
The MariaDB image in this project uses custom location /home/db-data
(not
a Docker volume) to store expanded database files. These files then can be
captured as a Docker layer and stored as an image to docker registry.
Image consumers download the image and start containers with instantaneously available data (no time-consuming database imports required).
Technically, the majority of the functionality is relying on upstream uselagoon/mariadb-drupal
Docker image.
Entrypoint script) had to be copied from upstream script and adjusted to support custom data directory.
Drupal website with a large database.
- CI process builds a website overnight.
- CI process captures the latest database as a new Docker layer in the database image.
- CI process tags and pushes image to the Docker registry.
- Website developers pull the latest image from the registry and build site locally. OR Subsequent CI builds pull the latest image from the registry and build site.
When required, website developers restart docker stack locally with an already imported database, which saves a significant amount of time for database imports.
- Download the
seed.sh
script from this repository:
curl -LO https://github.com/drevops/mariadb-drupal-data/releases/latest/download/seed.sh
chmod +x seed.sh
- Run the script with the path to your database dump and the image name:
./seed.sh path/to/db.sql myorg/myimage:latest
# with forced platform
DOCKER_DEFAULT_PLATFORM=linux/amd64 ./seed.sh path/to/db.sql myorg/myimage:latest
# for multi-platform image
DESTINATION_PLATFORMS=linux/amd64,linux/arm64 ./seed.sh path/to/db.sql myorg/myimage:latest
# with a custom base image (e.g., canary)
BASE_IMAGE=drevops/mariadb-drupal-data:canary ./seed.sh path/to/db.sql myorg/myimage:latest
Note that you should already be logged in to the registry as seed.sh
will be pushing an image as a part of docker buildx
process.
npm --prefix tests/bats install
tests/bats/node_modules/.bin/bats tests/bats/image.bats --tap
tests/bats/node_modules/.bin/bats tests/bats/seed.bats --tap
This project uses Year-Month-Patch versioning:
YY
: Last two digits of the year, e.g.,23
for 2023.m
: Numeric month, e.g., April is4
.patch
: Patch number for the month, starting at0
.
Example: 23.4.2
indicates the third patch in April 2023.
Versions are following versions of the upstream image to ease maintenance.
Releases are scheduled to occur at a minimum of once per month.
This image is built by GitHub Actions and tagged as follows:
YY.m.patch
tag - when release tag is published on GitHub.latest
- when release tag is published on GitHub.canary
- on every push tomain
branch
The seed.sh
script is automatically uploaded as a release asset and can be downloaded from the latest release.
Renovate bot is used to update dependencies. It creates a PR with the changes
and automatically merges it if CI passes. These changes are then released as
a canary
version.
This repository was created using the Scaffold project template