Skip to content

Commit

Permalink
refactor: update Dockerfile (modern practices, customizable image)
Browse files Browse the repository at this point in the history
Upgrade implicit image from mysql 5.7 to 8.0, allow customization via
TEST_MYSQL_DOCKER_IMAGE environment variable.
  • Loading branch information
OpatrilPeter committed Sep 20, 2024
1 parent b3c807e commit 5f8aa58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions tests/db/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
FROM mysql:5.7.42-debian
LABEL maintainer="Seznam.cz a.s."
ARG TEST_MYSQL_DOCKER_IMAGE
FROM ${TEST_MYSQL_DOCKER_IMAGE}
LABEL org.opencontainers.image.authors="Seznam.cz a.s."

WORKDIR /
ENV MYSQL_ROOT_PASSWORD password
ENV MYSQL_ROOT_PASSWORD=password
ADD test_database.sql /docker-entrypoint-initdb.d/

# Tests require us to restart running mysql instance. To this end, we will
# install and configure supervisord.
RUN apt-get update || apt-get install -y wget
RUN wget -O - https://repo.mysql.com/RPM-GPG-KEY-mysql-2023 | gpg --dearmor > /etc/apt/keyrings/mysql.gpg
RUN \
apt-get update && apt-get install -y \
patch \
Expand Down
3 changes: 2 additions & 1 deletion tests/runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ set -e
PREFIX="`hostname`-`id --user`-`echo $$`-"
IMAGE_NAME="${PREFIX}superiormysqlpp-test-mysql"
CONTAINER_NAME="${PREFIX}superiormysqlpp-testdb"
docker build --pull --tag=${IMAGE_NAME} db
TEST_MYSQL_DOCKER_IMAGE="${TEST_MYSQL_DOCKER_IMAGE:-mysql:8.0.39-debian}"
docker build --pull --tag=${IMAGE_NAME} --build-arg=TEST_MYSQL_DOCKER_IMAGE="${TEST_MYSQL_DOCKER_IMAGE}" db
docker rm --force ${CONTAINER_NAME} >/dev/null 2>&1 || true
docker run --detach --publish-all --name ${CONTAINER_NAME} ${IMAGE_NAME}
MYSQL_HOST=`docker inspect --format='{{.NetworkSettings.IPAddress}}' ${CONTAINER_NAME}`
Expand Down

0 comments on commit 5f8aa58

Please sign in to comment.