parent
29bac6c0d0
commit
4ee9040dff
|
|
@ -1,2 +0,0 @@
|
|||
.git/
|
||||
tests/
|
||||
|
|
@ -1,38 +1,33 @@
|
|||
FROM bitnami/minideb-extras:jessie-r13
|
||||
|
||||
FROM bitnami/minideb-extras:jessie-r14
|
||||
MAINTAINER Bitnami <containers@bitnami.com>
|
||||
|
||||
ENV BITNAMI_IMAGE_VERSION=5.7.18-r0 \
|
||||
BITNAMI_APP_NAME=mysql \
|
||||
PATH=/opt/bitnami/mysql/sbin:/opt/bitnami/mysql/bin:$PATH
|
||||
|
||||
# System packages required
|
||||
RUN install_packages libc6 libstdc++6 libgcc1 libncurses5 libtinfo5 zlib1g libssl1.0.0 libaio1
|
||||
|
||||
# Install mysql
|
||||
# Install required system packages and dependencies
|
||||
RUN install_packages libaio1 libc6 libgcc1 libncurses5 libssl1.0.0 libstdc++6 libtinfo5 zlib1g
|
||||
RUN bitnami-pkg unpack mysql-5.7.18-0 --checksum b2937c5409ef168b3c655387c17b0b3e8e899ff5f1e617de85a2087890490437
|
||||
|
||||
COPY rootfs /
|
||||
|
||||
ENV MYSQL_ROOT_PASSWORD= \
|
||||
MYSQL_ROOT_USER=root \
|
||||
MYSQL_USER= \
|
||||
MYSQL_PASSWORD= \
|
||||
MYSQL_DATABASE= \
|
||||
MYSQL_PORT=3306 \
|
||||
MYSQL_REPLICATION_MODE= \
|
||||
MYSQL_REPLICATION_USER= \
|
||||
MYSQL_REPLICATION_PASSWORD= \
|
||||
MYSQL_MASTER_HOST= \
|
||||
MYSQL_MASTER_PORT= \
|
||||
MYSQL_MASTER_ROOT_USER= \
|
||||
MYSQL_MASTER_ROOT_PASSWORD= \
|
||||
ALLOW_EMPTY_PASSWORD=no
|
||||
ENV ALLOW_EMPTY_PASSWORD="no" \
|
||||
BITNAMI_APP_NAME="mysql" \
|
||||
BITNAMI_IMAGE_VERSION="5.7.18-r2" \
|
||||
MYSQL_DATABASE="" \
|
||||
MYSQL_MASTER_HOST="" \
|
||||
MYSQL_MASTER_PORT="" \
|
||||
MYSQL_MASTER_ROOT_PASSWORD="" \
|
||||
MYSQL_MASTER_ROOT_USER="" \
|
||||
MYSQL_PASSWORD="" \
|
||||
MYSQL_PORT="3306" \
|
||||
MYSQL_REPLICATION_MODE="" \
|
||||
MYSQL_REPLICATION_PASSWORD="" \
|
||||
MYSQL_REPLICATION_USER="" \
|
||||
MYSQL_ROOT_PASSWORD="" \
|
||||
MYSQL_ROOT_USER="root" \
|
||||
MYSQL_USER="" \
|
||||
PATH="/opt/bitnami/mysql/bin:/opt/bitnami/mysql/sbin:$PATH"
|
||||
|
||||
VOLUME ["/bitnami/mysql"]
|
||||
|
||||
EXPOSE 3306
|
||||
|
||||
ENTRYPOINT ["/app-entrypoint.sh"]
|
||||
|
||||
CMD ["nami", "start", "--foreground", "mysql"]
|
||||
CMD ["nami","start","--foreground","mysql"]
|
||||
|
|
|
|||
|
|
@ -1,64 +1,15 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
. /opt/bitnami/base/functions
|
||||
. /opt/bitnami/base/helpers
|
||||
|
||||
print_welcome_page
|
||||
check_for_updates &
|
||||
|
||||
##
|
||||
## @brief Helper function to show an error when a password is empty and exit
|
||||
## param $1 Input name
|
||||
##
|
||||
empty_password_error() {
|
||||
error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development."
|
||||
exit 1
|
||||
}
|
||||
|
||||
##
|
||||
## @brief Helper function to show a warning when the ALLOW_EMPTY_PASSWORD flag is enabled
|
||||
##
|
||||
empty_password_enabled_warn() {
|
||||
warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment."
|
||||
}
|
||||
|
||||
##
|
||||
## @brief Helper function to check deprecated environment variables and warn about them
|
||||
## param $1 Deprecated environment variable to check
|
||||
## param $2 Suggested environment variable to use
|
||||
##
|
||||
check_for_deprecated_env() {
|
||||
if [[ -n "${!1}" ]]; then
|
||||
warn "The environment variable $1 is deprecated and will be removed in a future. Please use $2 instead"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "$1" == "nami" && "$2" == "start" ]] || [[ "$1" == "/init.sh" ]]; then
|
||||
# Check env vars to deprecate
|
||||
check_for_deprecated_env "MYSQL_MASTER_USER" "MYSQL_MASTER_ROOT_USER"
|
||||
export MYSQL_MASTER_ROOT_USER=${MYSQL_MASTER_USER:-${MYSQL_MASTER_ROOT_USER}}
|
||||
check_for_deprecated_env "MYSQL_MASTER_PASSWORD" "MYSQL_MASTER_ROOT_PASSWORD"
|
||||
export MYSQL_MASTER_ROOT_PASSWORD=${MYSQL_MASTER_PASSWORD:-${MYSQL_MASTER_ROOT_PASSWORD}}
|
||||
|
||||
# Validate passwords
|
||||
if [[ "$ALLOW_EMPTY_PASSWORD" =~ ^(yes|Yes|YES)$ ]]; then
|
||||
empty_password_enabled_warn
|
||||
else
|
||||
# Root user
|
||||
if [[ -z "$MYSQL_ROOT_PASSWORD" ]]; then
|
||||
empty_password_error MYSQL_ROOT_PASSWORD
|
||||
fi
|
||||
# Replication user
|
||||
if [[ -n "$MYSQL_REPLICATION_USER" && -z "$MYSQL_REPLICATION_PASSWORD" ]]; then
|
||||
empty_password_error MYSQL_REPLICATION_PASSWORD
|
||||
fi
|
||||
# Additional user creation
|
||||
if [[ -n "$MYSQL_USER" && -z "$MYSQL_PASSWORD" ]]; then
|
||||
empty_password_error MYSQL_PASSWORD
|
||||
fi
|
||||
fi
|
||||
|
||||
. /init.sh
|
||||
nami_initialize mysql
|
||||
info "Starting mysql..."
|
||||
info "Starting mysql... "
|
||||
fi
|
||||
|
||||
exec tini -- "$@"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
##
|
||||
## @brief Helper function to show an error when a password is empty and exit
|
||||
## param $1 Input name
|
||||
##
|
||||
empty_password_error() {
|
||||
error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development."
|
||||
exit 1
|
||||
}
|
||||
|
||||
##
|
||||
## @brief Helper function to show a warning when the ALLOW_EMPTY_PASSWORD flag is enabled
|
||||
##
|
||||
empty_password_enabled_warn() {
|
||||
warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment."
|
||||
}
|
||||
|
||||
##
|
||||
## @brief Helper function to check deprecated environment variables and warn about them
|
||||
## param $1 Deprecated environment variable to check
|
||||
## param $2 Suggested environment variable to use
|
||||
##
|
||||
check_for_deprecated_env() {
|
||||
if [[ -n "${!1}" ]]; then
|
||||
warn "The environment variable $1 is deprecated and will be removed in a future. Please use $2 instead"
|
||||
fi
|
||||
}
|
||||
|
||||
# Check env vars to deprecate
|
||||
check_for_deprecated_env "MYSQL_MASTER_USER" "MYSQL_MASTER_ROOT_USER"
|
||||
export MYSQL_MASTER_ROOT_USER=${MYSQL_MASTER_USER:-${MYSQL_MASTER_ROOT_USER}}
|
||||
check_for_deprecated_env "MYSQL_MASTER_PASSWORD" "MYSQL_MASTER_ROOT_PASSWORD"
|
||||
export MYSQL_MASTER_ROOT_PASSWORD=${MYSQL_MASTER_PASSWORD:-${MYSQL_MASTER_ROOT_PASSWORD}}
|
||||
|
||||
# Validate passwords
|
||||
if [[ "$ALLOW_EMPTY_PASSWORD" =~ ^(yes|Yes|YES)$ ]]; then
|
||||
empty_password_enabled_warn
|
||||
else
|
||||
# Root user
|
||||
if [[ -z "$MYSQL_ROOT_PASSWORD" ]]; then
|
||||
empty_password_error MYSQL_ROOT_PASSWORD
|
||||
fi
|
||||
# Replication user
|
||||
if [[ -n "$MYSQL_REPLICATION_USER" && -z "$MYSQL_REPLICATION_PASSWORD" ]]; then
|
||||
empty_password_error MYSQL_REPLICATION_PASSWORD
|
||||
fi
|
||||
# Additional user creation
|
||||
if [[ -n "$MYSQL_USER" && -z "$MYSQL_PASSWORD" ]]; then
|
||||
empty_password_error MYSQL_PASSWORD
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
{
|
||||
"rootPassword": "{{$global.env.MYSQL_ROOT_PASSWORD}}",
|
||||
"rootUser": "{{$global.env.MYSQL_ROOT_USER}}",
|
||||
"username": "{{$global.env.MYSQL_USER}}",
|
||||
"password": "{{$global.env.MYSQL_PASSWORD}}",
|
||||
"allowEmptyPassword": "{{$global.env.ALLOW_EMPTY_PASSWORD}}",
|
||||
"database": "{{$global.env.MYSQL_DATABASE}}",
|
||||
"port": "{{$global.env.MYSQL_PORT}}",
|
||||
"replicationMode": "{{$global.env.MYSQL_REPLICATION_MODE}}",
|
||||
"replicationUser": "{{$global.env.MYSQL_REPLICATION_USER}}",
|
||||
"replicationPassword": "{{$global.env.MYSQL_REPLICATION_PASSWORD}}",
|
||||
"masterHost": "{{$global.env.MYSQL_MASTER_HOST}}",
|
||||
"masterPort": "{{$global.env.MYSQL_MASTER_PORT}}",
|
||||
"masterRootUser": "{{$global.env.MYSQL_MASTER_ROOT_USER}}",
|
||||
"masterRootPassword": "{{$global.env.MYSQL_MASTER_ROOT_PASSWORD}}",
|
||||
"allowEmptyPassword": "{{$global.env.ALLOW_EMPTY_PASSWORD}}"
|
||||
}
|
||||
"masterRootUser": "{{$global.env.MYSQL_MASTER_ROOT_USER}}",
|
||||
"password": "{{$global.env.MYSQL_PASSWORD}}",
|
||||
"port": "{{$global.env.MYSQL_PORT}}",
|
||||
"replicationMode": "{{$global.env.MYSQL_REPLICATION_MODE}}",
|
||||
"replicationPassword": "{{$global.env.MYSQL_REPLICATION_PASSWORD}}",
|
||||
"replicationUser": "{{$global.env.MYSQL_REPLICATION_USER}}",
|
||||
"rootPassword": "{{$global.env.MYSQL_ROOT_PASSWORD}}",
|
||||
"rootUser": "{{$global.env.MYSQL_ROOT_USER}}",
|
||||
"username": "{{$global.env.MYSQL_USER}}"
|
||||
}
|
||||
Loading…
Reference in New Issue