Skip to content

Instantly share code, notes, and snippets.

@Umaaz
Created February 12, 2020 08:26
Show Gist options
  • Save Umaaz/f1778ac35bbe4c3f2597c0c27737eeee to your computer and use it in GitHub Desktop.
Save Umaaz/f1778ac35bbe4c3f2597c0c27737eeee to your computer and use it in GitHub Desktop.
A set of commands to help with laradock.
#!/bin/bash
# REPO_DIR should be the root directory that you want mounted into the docker.
# I have this script in the root of my laradock clone in ~/repo/laradock, and mount the directory ~/repo into the docker as /var/www/repo
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
export REPO_DIR="$(dirname $DIR)"
alias composer='docker exec -it --user=laradock laradock_workspace_1 composer --working-dir=/var/www/${PWD:${#REPO_DIR}}'
alias php='docker exec -it --workdir=/var/www/${PWD:${#REPO_DIR}} --user=laradock laradock_workspace_1 php'
alias larastart='docker-compose -f ${REPO_DIR}/laradock/docker-compose.yml --project-directory=${REPO_DIR}/laradock up -d nginx'
alias larastop='docker-compose -f ${REPO_DIR}/laradock/docker-compose.yml --project-directory=${REPO_DIR}/laradock down'
alias larabuild='docker-compose -f ${REPO_DIR}/laradock/docker-compose.yml --project-directory=${REPO_DIR}/laradock up --build -d nginx'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment