Last active
April 24, 2017 12:13
-
-
Save ang3lkar/db7faaacdb2ed9a79b74bd14b4e1780c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export YELLOW="\033[0;33m" | |
export NC="\033[0m" # No Color | |
# Until I figure out how to set the branch via argument, I have to edit this line | |
export SOURCE_DIR=~/projects/workable | |
export TARGET_DIR=~/projects/docker/workable | |
export BRANCH=research/docker | |
export DOCKER_TAG=latest | |
export RESET_DATA=false | |
cd $SOURCE_DIR | |
echo "${YELLOW}Checking out ${BRANCH}${NC}" | |
git checkout -q $BRANCH | |
echo "${YELLOW}Pulling latest version${NC}" | |
git pull origin $BRANCH | |
echo "${YELLOW}Creating the ${BRANCH} worktree${NC}" | |
rm -rf $TARGET_DIR/$BRANCH | |
mkdir $TARGET_DIR/$BRANCH | |
git worktree add $TARGET_DIR/$BRANCH $BRANCH -f | |
# Some more config | |
cp $SOURCE_DIR/.env_sample $TARGET_DIR/$BRANCH/.env | |
sed -i '' s/\'//g $TARGET_DIR/$BRANCH/.env # remove bloody quotes | |
sed -i '' s/lvh.me/foo.bar.me/g $TARGET_DIR/$BRANCH/.env # required for the session domain | |
cp $SOURCE_DIR/config/database.docker.yml $TARGET_DIR/$BRANCH/config/database.yml | |
printf "${YELLOW}Copying node_modules...${NC}" | |
cp -R $SOURCE_DIR/node_modules $TARGET_DIR/$BRANCH/node_modules/ | |
printf "\r${YELLOW}Copying node_modules...${NC}done" | |
cd $TARGET_DIR/$BRANCH | |
echo "${YELLOW}Running Docker-compose for workable/core:${DOCKER_TAG}${NC}" | |
docker-compose up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export YELLOW="\033[0;33m" | |
export NC="\033[0m" # No Color | |
# Until I figure out how to set the branch via argument, I have to edit this line | |
export BRANCH=research/docker | |
export TARGET_DIR=~/projects/docker/workable | |
export RESET_DATA=false | |
cd ~/projects/workable | |
echo "${YELLOW}Checking out the ${BRANCH} branch${NC}" | |
git checkout -q $BRANCH | |
echo "${YELLOW}Pulling latest version${NC}" | |
# git pull --rebase=preserve | |
echo "${YELLOW}Preparing the ${TARGET_DIR}/${BRANCH} directory${NC}" | |
rm -rf $TARGET_DIR/$BRANCH | |
mkdir $TARGET_DIR/$BRANCH | |
echo "${YELLOW}Creating ${BRANCH} worktree${NC}" | |
git worktree add $TARGET_DIR/$BRANCH $BRANCH -f | |
echo "${YELLOW}Copying env file${NC}" | |
cp .env_sample $TARGET_DIR/$BRANCH/.env | |
sed -i '' s/\'//g $TARGET_DIR/$BRANCH/.env # remove bloody quotes | |
sed -i '' s/lvh.me/foo.bar.me/g $TARGET_DIR/$BRANCH/.env # required for the session domain | |
echo "${YELLOW}Creating database.yml${NC}" | |
cp config/database.docker.yml $TARGET_DIR/$BRANCH/config/database.yml | |
echo "${YELLOW}Switching to ${TARGET_DIR}/${BRANCH}/${NC}" | |
cd $TARGET_DIR/$BRANCH | |
export DOCKER_TAG=`git rev-parse --verify HEAD --short` | |
echo "${YELLOW}Docker image: workable/core:${DOCKER_TAG}${NC}" | |
docker build -t workable/core:$DOCKER_TAG . | |
echo "${YELLOW}Running Docker-compose for workable/core:${DOCKER_TAG}${NC}" | |
docker-compose up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment