Skip to content

Commit

Permalink
windows support
Browse files Browse the repository at this point in the history
rename var, separate build
  • Loading branch information
bagart committed Mar 3, 2019
1 parent 0258726 commit b869cd2
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 41 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ LARADOCK_PROJECT_SERVICES='workspace nginx php-fpm redis postgres'
LARADOCK_PROJECT_NAME=laradock_$LARADOCKENV_PROJECT_NAME

LARADOCK_PATH=`realpath ../"$LARADOCK_PROJECT_NAME"`
PROJECT_PATH=`realpath .`

LARADOCK_PROJECT_PATH=`realpath .`

LARADOCKENV_PATH=`dirname "${BASH_SOURCE[0]}"`
14 changes: 7 additions & 7 deletions .laradock/customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
if [ -d "_env" ]; then
echo "---------- Laradock customize: $LARADOCKENV_PROJECT_NAME ----------"

LaraDock_ENV_CUR=dev
LARADOCK_ENV_CUR=dev
if [[ "$1" != "" ]]; then
LaraDock_ENV_CUR=$1;
LARADOCK_ENV_CUR=$1;
else
if [[ "$LaraDock_ENV" != "" ]]; then
LaraDock_ENV_CUR=$LaraDock_ENV;
if [[ "$LARADOCK_ENV" != "" ]]; then
LARADOCK_ENV_CUR=$LARADOCK_ENV;
fi
fi

Expand All @@ -18,9 +18,9 @@ if [ -d "_env" ]; then
cp -r _env/default/* ./
fi

if [ -d "_env/$LaraDock_ENV_CUR" ]; then
echo "---------- prepare ENV: $LaraDock_ENV_CUR -----------"
cp -r _env/$LaraDock_ENV_CUR/* ./
if [ -d "_env/$LARADOCK_ENV_CUR" ]; then
echo "---------- prepare ENV: $LARADOCK_ENV_CUR -----------"
cp -r _env/$LARADOCK_ENV_CUR/* ./
fi

if [ -f "../laradock_$LARADOCKENV_PROJECT_NAME/prepare.sh" ]; then
Expand Down
25 changes: 19 additions & 6 deletions .laradock/dotenv_rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,23 @@ cd $LARADOCK_PATH
sed -i "s/^WORKSPACE_INSTALL_XDEBUG=.*/WORKSPACE_INSTALL_XDEBUG=true/" .env
sed -i "s/^PHP_FPM_INSTALL_XDEBUG=.*/PHP_FPM_INSTALL_XDEBUG=true/" .env

#if [[ $DOCKERHOST_OS != "Linux" && $DOCKERHOST_OS != "Mac" ]]; then
# # Repair windows permissions
# sed -i "s#^\( *\-\) \($.*_PORT.*\)\$#\1 \"\2\"#" docker-compose.yml
# sed -i "s#^\( *\-\) \($.*\)\$#\1 d:\2#" docker-compose.yml
#fi;
if [[ $DOCKERHOST_OS = "Cygwin" || $DOCKERHOST_OS = "MinGw" ]]; then
# If you are using Docker Sync. For `osx` use 'native_osx', for `windows` use 'unison', for `linux` docker-sync is not required
sed -i "s#^DOCKER_SYNC_STRATEGY=.*#DOCKER_SYNC_STRATEGY=unison#" .env

# Change the separator from : to ; on Windows
sed -i "s#^COMPOSE_PATH_SEPARATOR=.*#COMPOSE_PATH_SEPARATOR=;#" .env

# Alternative: Repair windows permissions
#sed -i 's#^\( *\-\) \(${\(APP_CODE_PATH_HOST\|DATA_PATH_HOST\)}\)#\1 d:\2#' docker-compose.yml
fi;

if [[ $DOCKERHOST_OS = "Mac" ]]; then
# If you are using Docker Sync. For `osx` use 'native_osx', for `windows` use 'unison', for `linux` docker-sync is not required
# default: native_osx
sed -i "s#^DOCKER_SYNC_STRATEGY=.*#DOCKER_SYNC_STRATEGY=native_osx#" .env
# default: :
sed -i "s#^COMPOSE_PATH_SEPARATOR=.*#COMPOSE_PATH_SEPARATOR=:#" .env
fi;

cd $LARADOCK_CURRENT_PATH
exit
6 changes: 3 additions & 3 deletions .laradock/rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
. "`dirname $0`/init.sh"
echo "---------- Laradock rebuild $1 $2 $3: $LARADOCKENV_PROJECT_NAME ----------"

LaraDock_DBG=1;
LARADOCK_DBG=1;
if [[ "$1" == "--silence" || "$2" == "--silence" || "$3" == "--silence" ]]; then
LaraDock_DBG=0;
LARADOCK_DBG=0;
fi

$LARADOCKENV_PATH/.laradock/rebuild_containers.sh $1 $2 $3

$LARADOCKENV_PATH/up.sh -
$LARADOCKENV_PATH/app/install-db-seed.sh
if [[ "$LaraDock_DBG" != "0" ]]; then
if [[ "$LARADOCK_DBG" != "0" ]]; then
$LARADOCKENV_PATH/ps.sh
fi
38 changes: 14 additions & 24 deletions .laradock/rebuild_containers.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,30 @@
#! /bin/bash
. "`dirname $0`/init.sh"
echo "---------- Laradock rebuild: $LARADOCKENV_PROJECT_NAME ----------"

LaraDock_DBG=1;
LARADOCK_DBG=1;
if [[ "$1" == "--silence" || "$2" == "--silence" || "$3" == "--silence" ]]; then
LaraDock_DBG=0;
LARADOCK_DBG=0;
fi

LaraDock_STOP=1;
if [[ "$1" == "--stopped" || "$2" == "--stopped" || "$3" == "--stopped" ]]; then
LaraDock_STOP=0;
fi

LaraDock_FIX=0;
LARADOCK_REBUILD_FIX=0;
if [[ "$1" == "--fix" || "$2" == "--fix" || "$3" == "--fix" ]]; then
LaraDock_FIX=1;
LARADOCK_REBUILD_FIX=1;
fi

cd $LARADOCK_PATH
if [[ "$LaraDock_STOP" == "1" ]]; then
docker-compose stop
fi
docker-compose rm -f
rm -rf .data
$LARADOCKENV_PATH/.laradock/rm_containers.sh $1 $2 $3

LaraDock_PARAM='cat'
if [[ "$LaraDock_DBG" == "0" ]]; then
LaraDock_PARAM='grep -v ^\s---'
cd $LARADOCK_PATH
LARADOCK_REBUILD_FILTER='cat'
if [[ "$LARADOCK_DBG" == "0" ]]; then
LARADOCK_REBUILD_FILTER='grep -v ^\s---'
fi

LaraDockEnv_BUILD_PARAM=''
if [[ "$LaraDock_FIX" == "1" ]]; then
LARADOCK_REBUILD_PARAM=''
if [[ "$LARADOCK_REBUILD_FIX" == "1" ]]; then
# VERY SLOW
LaraDockEnv_BUILD_PARAM=' --no-cache '
LARADOCK_REBUILD_PARAM=' --no-cache '
fi

echo ---------- rebuild$LaraDockEnv_BUILD_PARAM: $LARADOCK_PROJECT_SERVICES ----------
docker-compose build $LaraDockEnv_BUILD_PARAM --pull $LARADOCK_PROJECT_SERVICES | $LaraDock_PARAM
echo ---------- Laradock rebuild $LARADOCK_REBUILD_PARAM: $LARADOCK_PROJECT_SERVICES ----------
docker-compose build $LARADOCK_REBUILD_PARAM --pull $LARADOCK_PROJECT_SERVICES | $LARADOCK_REBUILD_FILTER
cd $LARADOCK_CURRENT_PATH
17 changes: 17 additions & 0 deletions .laradock/rm_containers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#! /bin/bash
. "`dirname $0`/init.sh"
echo "---------- Laradock rm: $LARADOCKENV_PROJECT_NAME ----------"

LaraDock_STOP=1;
if [[ "$1" == "--stopped" || "$2" == "--stopped" || "$3" == "--stopped" ]]; then
LaraDock_STOP=0;
fi


cd $LARADOCK_PATH
if [[ "$LaraDock_STOP" == "1" ]]; then
docker-compose stop
fi
docker-compose rm -f
rm -rf .data
cd $LARADOCK_CURRENT_PATH

0 comments on commit b869cd2

Please sign in to comment.