Browse Source

* windows adjust docker cmd

master
toxa 2 years ago
parent
commit
0bbc4eedd7
  1. 15
      bash/_docker-cmd.sh
  2. 18
      bash/composer-set-to-1.sh
  3. 18
      bash/composer-set-to-2.sh
  4. 7
      bash/enter-to-workspace.sh
  5. 6
      bash/mysql.sh
  6. 6
      bash/restart-nginx.sh
  7. 18
      bash/root-onto-workspace.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

18
bash/composer-set-to-1.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} composer self-update --1

18
bash/composer-set-to-2.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} composer self-update --2

7
bash/enter-to-workspace.sh

@ -1,13 +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 exec -ti ${CONTAINER} su laradock
$DOCKER_CMD exec -ti ${CONTAINER} su laradock

6
bash/mysql.sh

@ -1,4 +1,8 @@
#!/bin/bash
. ./_docker-cmd.sh || {
echo "no docker cmd is presented" && exit 1
}
CONTAINER=$(docker ps | grep mariadb | awk '{print $1}')
if [[ -z "${CONTAINER}" ]]; then
@ -6,4 +10,4 @@ if [[ -z "${CONTAINER}" ]]; then
exit 1
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
. ./_docker-cmd.sh || {
echo "no docker cmd is presented" && exit 1
}
CONTAINER=$(docker ps | grep nginx | awk '{print $1}')
if [[ -z "${CONTAINER}" ]]; then
@ -6,4 +10,4 @@ if [[ -z "${CONTAINER}" ]]; then
exit 1
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}
Loading…
Cancel
Save