2 Commits

  1. 15
      bash/_docker-cmd.sh
  2. 7
      bash/enter-to-workspace.sh
  3. 6
      bash/mysql.sh
  4. 6
      bash/restart-nginx.sh
  5. 18
      bash/root-onto-workspace.sh
  6. 6
      bash/update-composer.sh

15
bash/_docker-cmd.sh

@ -0,0 +1,15 @@
#!/bin/bash
# Grab OS type
if [[ "$(uname)" == "Darwin" ]]; then
OS_TYPE="OSX"
else
OS_TYPE=$(expr substr $(uname -s) 1 5)
fi
DOCKER_CMD=docker
if [[ $OS_TYPE == "MINGW" ]]; then
DOCKER_CMD="winpty docker"
fi
export DOCKER_CMD

7
bash/enter-to-workspace.sh

@ -1,13 +1,18 @@
#!/bin/bash #!/bin/bash
. ./_docker-cmd.sh || {
echo "no docker cmd is presented" && exit 1
}
PHP_VERSION=$1 # Without dot PHP_VERSION=$1 # Without dot
if [[ -z "${PHP_VERSION}" ]]; then PHP_VERSION=74; fi if [[ -z "${PHP_VERSION}" ]]; then PHP_VERSION=74; fi
CONTAINER=$(docker ps | grep workspace${PHP_VERSION} | awk '{print $1}') CONTAINER=$(docker ps | grep workspace${PHP_VERSION} | awk '{print $1}')
if [[ -z "${CONTAINER}" ]]; then if [[ -z "${CONTAINER}" ]]; then
echo "Unable to find container: workspace${PHP_VERSION}" echo "Unable to find container: workspace${PHP_VERSION}"
exit 1 exit 1
fi fi
docker exec -ti ${CONTAINER} su laradock
$DOCKER_CMD exec -ti ${CONTAINER} su laradock

6
bash/mysql.sh

@ -1,4 +1,8 @@
#!/bin/bash #!/bin/bash
. ./_docker-cmd.sh || {
echo "no docker cmd is presented" && exit 1
}
CONTAINER=$(docker ps | grep mariadb | awk '{print $1}') CONTAINER=$(docker ps | grep mariadb | awk '{print $1}')
if [[ -z "${CONTAINER}" ]]; then if [[ -z "${CONTAINER}" ]]; then
@ -6,4 +10,4 @@ if [[ -z "${CONTAINER}" ]]; then
exit 1 exit 1
fi fi
docker exec -ti ${CONTAINER} bash -c 'LANG=ru_RU.UTF-8 mysql -u root -p123456'
$DOCKER_CMD exec -ti ${CONTAINER} bash -c 'LANG=ru_RU.UTF-8 mysql -u root -p123456'

6
bash/restart-nginx.sh

@ -1,4 +1,8 @@
#!/bin/bash #!/bin/bash
. ./_docker-cmd.sh || {
echo "no docker cmd is presented" && exit 1
}
CONTAINER=$(docker ps | grep nginx | awk '{print $1}') CONTAINER=$(docker ps | grep nginx | awk '{print $1}')
if [[ -z "${CONTAINER}" ]]; then if [[ -z "${CONTAINER}" ]]; then
@ -6,4 +10,4 @@ if [[ -z "${CONTAINER}" ]]; then
exit 1 exit 1
fi fi
docker exec -ti ${CONTAINER} nginx -s reload
$DOCKER_CMD exec -ti ${CONTAINER} nginx -s reload

18
bash/root-onto-workspace.sh

@ -0,0 +1,18 @@
#!/bin/bash
. ./_docker-cmd.sh || {
echo "no docker cmd is presented" && exit 1
}
PHP_VERSION=$1 # Without dot
if [[ -z "${PHP_VERSION}" ]]; then PHP_VERSION=74; fi
CONTAINER=$(docker ps | grep workspace${PHP_VERSION} | awk '{print $1}')
if [[ -z "${CONTAINER}" ]]; then
echo "Unable to find container: workspace${PHP_VERSION}"
exit 1
fi
$DOCKER_CMD exec -ti ${CONTAINER}

6
bash/update-composer.sh

@ -1,4 +1,8 @@
#!/bin/bash #!/bin/bash
. ./_docker-cmd.sh || {
echo "no docker cmd is presented" && exit 1
}
PHP_VERSION=$1 # Without dot PHP_VERSION=$1 # Without dot
COMPOSER_VERSION=$2 COMPOSER_VERSION=$2
@ -15,4 +19,4 @@ if [[ -z "${COMPOSER_VERSION}" ]]; then
COMPOSER_VERSION=1 COMPOSER_VERSION=1
fi fi
docker exec -ti "${CONTAINER}" composer self-update --${COMPOSER_VERSION}
$DOCKER_CMD exec -ti "${CONTAINER}" composer self-update --${COMPOSER_VERSION}
Loading…
Cancel
Save