Upgrade the Docker setup and dependencies
This commit is contained in:
10
docker/db/.dockerignore
Normal file
10
docker/db/.dockerignore
Normal file
@@ -0,0 +1,10 @@
|
||||
**/*.log
|
||||
**/*.md
|
||||
**/*.sql.gz
|
||||
**/._*
|
||||
**/.DS_Store
|
||||
**/.gitignore
|
||||
**/Thumbs.db
|
||||
.dockerignore
|
||||
data/
|
||||
Dockerfile
|
||||
1
docker/db/.gitignore
vendored
Normal file
1
docker/db/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
data/
|
||||
6
docker/db/Dockerfile
Normal file
6
docker/db/Dockerfile
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM mysql:5.7
|
||||
|
||||
COPY docker-healthcheck.sh /usr/local/bin/docker-healthcheck
|
||||
RUN chmod +x /usr/local/bin/docker-healthcheck
|
||||
|
||||
HEALTHCHECK CMD ["docker-healthcheck"]
|
||||
30
docker/db/docker-healthcheck.sh
Executable file
30
docker/db/docker-healthcheck.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2014-2016 Docker, Inc.
|
||||
# Origin: https://github.com/docker-library/healthcheck/blob/master/mysql/docker-healthcheck
|
||||
# Licence: MIT
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
if [ "$MYSQL_RANDOM_ROOT_PASSWORD" ] && [ -z "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then
|
||||
# there's no way we can guess what the random MySQL password was
|
||||
echo >&2 'healthcheck error: cannot determine random root password (and MYSQL_USER and MYSQL_PASSWORD were not set)'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
host="$(hostname --ip-address || echo '127.0.0.1')"
|
||||
user="${MYSQL_USER:-root}"
|
||||
export MYSQL_PWD="${MYSQL_PASSWORD:-$MYSQL_ROOT_PASSWORD}"
|
||||
|
||||
args=(
|
||||
# force mysql to not use the local "mysqld.sock" (test "external" connectibility)
|
||||
-h"$host"
|
||||
-u"$user"
|
||||
--silent
|
||||
)
|
||||
|
||||
if select="$(echo 'SELECT 1' | mysql "${args[@]}")" && [ "$select" = '1' ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exit 1
|
||||
Reference in New Issue
Block a user