Browse Source

+ locales into db container

master
parent
commit
feac856355
  1. 2
      bash/mysql.sh
  2. 34
      docker-compose.yml.example
  3. 9
      dockerfiles/db/Dockerfile
  4. 101
      dockerfiles/workspace/xdebug.sh

2
bash/mysql.sh

@ -1,3 +1,3 @@
#!/bin/bash
cd $HOME/structure
docker-compose exec db mysql -u root -p123456
docker-compose exec db bash -c 'LANG=ru_RU.UTF-8 mysql -u root -p123456'

34
docker-compose.yml.example

@ -87,36 +87,6 @@ services:
- ${PROJECTS_DIR}:/var/www
extra_hosts:
- "dockerhost:${DOCKER_HOST_IP}"
workspace_alex2911:
build:
context: ./dockerfiles/workspace
args:
- PHP_VERSION=${WORKSPACE_PHP_VERSION}
- PUID=${WORKSPACE_PUID}
- PGID=${WORKSPACE_PGID}
- TZ=${WORKSPACE_TIMEZONE}
- COMPOSER_GLOBAL_INSTALL=${WORKSPACE_COMPOSER_GLOBAL_INSTALL}
- COMPOSER_AUTH=${WORKSPACE_COMPOSER_AUTH}
- COMPOSER_REPO_PACKAGIST=${WORKSPACE_COMPOSER_REPO_PACKAGIST}
- INSTALL_WP_CLI=${WORKSPACE_INSTALL_WP_CLI}
- INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG}
- INSTALL_SSH=${WORKSPACE_INSTALL_SSH}
- SSH_PASSPHRAZE=${WORKSPACE_SSH_PASSPHRAZE}
- INSTALL_FSWATCH=${WORKSPACE_INSTALL_FSWATCH}
- INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
- NODE_VERSION=${WORKSPACE_NODE_VERSION}
- NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY}
- INSTALL_YARN=${WORKSPACE_INSTALL_YARN}
- YARN_VERSION=${WORKSPACE_YARN_VERSION}
- INSTALL_GULP=${WORKSPACE_INSTALL_GULP}
- INSTALL_MYSQL_CLIENT=${WORKSPACE_INSTALL_MYSQL_CLIENT}
- INSTALL_PING=${WORKSPACE_INSTALL_PING}
- INSTALL_PYTHON=${WORKSPACE_INSTALL_PYTHON}
restart: always
volumes:
- ${PROJECTS_DIR}:/var/www
extra_hosts:
- "dockerhost:${DOCKER_HOST_IP}"
sphinx:
build: ./dockerfiles/sphinx
restart: always
@ -130,13 +100,15 @@ services:
expose:
- "9306"
db:
image: mariadb
build: ./dockerfiles/db
restart: always
environment:
MYSQL_ROOT_PASSWORD: 123456
volumes:
- database:/var/lib/mysql
- ./hostfiles:/hostfiles
- ./config/mariadb:/etc/mysql/conf.d
- ./log/mariadb:/var/log/mariadb
ports:
- "3306:3306"
phpmyadmin:

9
dockerfiles/db/Dockerfile

@ -0,0 +1,9 @@
FROM mariadb
RUN apt update && apt install -y locales
RUN sed -i 's/# ru_RU.UTF-8/ru_RU.UTF-8/' /etc/locale.gen
RUN locale-gen
RUN echo "export LANG=ru_RU.UTF-8" > /root/.bashrc

101
dockerfiles/workspace/xdebug.sh

@ -0,0 +1,101 @@
#! /bin/bash
# NOTE: At the moment, this has only been confirmed to work with PHP 7
# Grab full name of workspace container
WORKSPACE_CONTAINER=$(docker ps | grep workspace | awk '{print $1}')
# Grab OS type
if [[ "$(uname)" == "Darwin" ]]; then
OS_TYPE="OSX"
else
OS_TYPE=$(expr substr $(uname -s) 1 5)
fi
xdebug_status ()
{
echo 'xDebug status'
# If running on Windows, need to prepend with winpty :(
if [[ $OS_TYPE == "MINGW" ]]; then
winpty docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
else
docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
fi
}
xdebug_start ()
{
echo 'Start xDebug'
# And uncomment line with xdebug extension, thus enabling it
ON_CMD="sed -i 's/^;zend_extension=/zend_extension=/g' \
/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
# If running on Windows, need to prepend with winpty :(
if [[ $OS_TYPE == "MINGW" ]]; then
winpty docker exec -it $WORKSPACE_CONTAINER bash -c "${ON_CMD}"
docker restart $WORKSPACE_CONTAINER
winpty docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
else
docker exec -it $WORKSPACE_CONTAINER bash -c "${ON_CMD}"
docker restart $WORKSPACE_CONTAINER
docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
fi
}
xdebug_stop ()
{
echo 'Stop xDebug'
# Comment out xdebug extension line
OFF_CMD="sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
# If running on Windows, need to prepend with winpty :(
if [[ $OS_TYPE == "MINGW" ]]; then
# This is the equivalent of:
# winpty docker exec -it laradock_php-fpm_1 bash -c 'bla bla bla'
# Thanks to @michaelarnauts at https://github.com/docker/compose/issues/593
winpty docker exec -it $WORKSPACE_CONTAINER bash -c "${OFF_CMD}"
docker restart $WORKSPACE_CONTAINER
#docker-compose restart php-fpm
winpty docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
else
docker exec -it $WORKSPACE_CONTAINER bash -c "${OFF_CMD}"
# docker-compose restart php-fpm
docker restart $WORKSPACE_CONTAINER
docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
fi
}
case $@ in
stop|STOP)
xdebug_stop
;;
start|START)
xdebug_start
;;
status|STATUS)
xdebug_status
;;
*)
echo "xDebug [Stop | Start | Status] in the ${WORKSPACE_CONTAINER} container."
echo "xDebug must have already been installed."
echo "Usage:"
echo " .php-fpm/xdebug stop|start|status"
esac
exit 1
Loading…
Cancel
Save