Created
May 19, 2021 23:30
-
-
Save bigdawggi/8ef9c27673bfa7a34b73f886d2dcfe53 to your computer and use it in GitHub Desktop.
Docker for Composer and Yarn
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
#!/bin/bash | |
# Go to script location | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |
cd $DIR | |
# Specify our version of node to run | |
composerVer="1.6.5" | |
# This is a little magic that makes it possible to forward an SSH agent into docker | |
unameS="$(uname -s)" | |
case "${unameS}" in | |
Darwin*) | |
SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock | |
;; | |
*) | |
esac | |
# Append any arguments passed to this script. We have to do this as a variable, | |
# as doing this as the last parameter to the docker run command didn't respect | |
# the arguments | |
cmd="composer $@" | |
docker run -it --rm \ | |
-v $PWD:/usr/local/app \ | |
-v ${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK} \ | |
-v ~/.ssh/known_hosts:/root/.ssh/known_hosts:delegated \ | |
-e SSH_AUTH_SOCK=${SSH_AUTH_SOCK} \ | |
-e HOST_USER=$(whoami) \ | |
-e COMPOSER_MEMORY_LIMIT=-1 \ | |
-w /usr/local/app \ | |
composer:$composerVer \ | |
$cmd |
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
#!/bin/bash | |
# Go to script location | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |
cd $DIR | |
# Specify our version of node to run | |
nodeVer="14.1" | |
# This is a little magic that makes it possible to forward an SSH agent into docker | |
unameS="$(uname -s)" | |
case "${unameS}" in | |
Darwin*) | |
SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock | |
;; | |
*) | |
esac | |
# Append any arguments passed to this script. We have to do this as a variable, | |
# as doing this as the last parameter to the docker run command didn't respect | |
# the arguments | |
cmd="yarn $@" | |
docker run -it --rm \ | |
-v $PWD:/usr/local/app \ | |
-v ${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK} \ | |
-v ~/.ssh/known_hosts:/root/.ssh/known_hosts:delegated \ | |
-e SSH_AUTH_SOCK=${SSH_AUTH_SOCK} \ | |
-e HOST_USER=$(whoami) \ | |
-w /usr/local/app \ | |
node:$nodeVer \ | |
$cmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment