forked from ambientum/ambientum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands.ps1
59 lines (49 loc) · 2.27 KB
/
commands.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Where the ambientum cache will live
$A_CACHE_HOME = "$($ENV:UserProfile)/AppData/Local/ambientum"
# Define specific cache directories
$A_NPM_CONFIG = "$($A_CACHE_HOME)/npm-config"
$A_NPM_CACHE = "$($A_CACHE_HOME)/npm-cache"
$A_COMPOSER_CACHE = "$($A_CACHE_HOME)/composer"
$A_YARN_BIN = "$($A_CACHE_HOME)/yarn/bin"
$A_YARN_CONFIG = "$($A_CACHE_HOME)/yarn/config"
$A_YARN_CACHE = "$($A_CACHE_HOME)/yarn/cache"
# Create directories
mkdir $A_CACHE_HOME -ErrorAction:SilentlyContinue | Out-Null
mkdir $A_NPM_CONFIG -ErrorAction:SilentlyContinue | Out-Null
mkdir $A_NPM_CACHE -ErrorAction:SilentlyContinue | Out-Null
mkdir $A_COMPOSER_CACHE -ErrorAction:SilentlyContinue | Out-Null
mkdir $A_YARN_BIN -ErrorAction:SilentlyContinue | Out-Null
mkdir $A_YARN_CONFIG -ErrorAction:SilentlyContinue | Out-Null
mkdir $A_YARN_CACHE -ErrorAction:SilentlyContinue | Out-Null
# When using private projects, a SSH Key may be needed
# this line will provide your user ssh key
$A_SSH_HOME = "$($ENV:UserProfile)/.ssh"
###########################################
#### DO NOT EDIT BELOW THIS LINE UNLESS #
#### YOU KNOW WHAT YOU'RE DOING #
###########################################
#reset permissions
icacls $A_CACHE_HOME /t /q /grant "$($ENV:UserName):f" | Out-Null
# Mount for SSH Directories
$A_SSH_NODE_MOUNT = "$($A_SSH_HOME):/home/node-user/.ssh"
$A_SSH_PHP_MOUNT = "$($A_SSH_HOME):/home/php-user/.ssh"
# Mount for cache
$A_NPM_CONFIG_MOUNT = "$($A_NPM_CONFIG):/home/node-user/.npm-packages"
$A_NPM_CACHE_MOUNT = "$($A_NPM_CACHE):/home/node-user/.npm"
$A_COMPOSER_MOUNT = "$($A_COMPOSER_CACHE):/home/php-user/.composer"
$A_YARN_BIN_MOUNT = "$($A_YARN_BIN):/home/node-user/.local/bin"
$A_YARN_CONFIG_MOUNT = "$($A_YARN_CONFIG):/home/node-user/.yarn-config"
$A_YARN_CACHE_MOUNT = "$($A_YARN_CACHE):/home/node-user/.yarn-cache"
####
# Alias for NPM And other node commands
####
# Node Env
function nAlias() {
docker run -it --rm -v "$(Get-Location):/var/www/app" -v $A_NPM_CACHE_MOUNT -v $A_YARN_BIN_MOUNT -v $A_YARN_CONFIG_MOUNT -v $A_YARN_CACHE_MOUNT -v $A_NPM_CONFIG_MOUNT -v $A_SSH_NODE_MOUNT ambientum/node:7 @args
}
Set-alias n nAlias
# PHP Env
function pAlias() {
docker run -it --rm -v "$(Get-Location):/var/www/app" -v $A_COMPOSER_MOUNT -v $A_SSH_PHP_MOUNT ambientum/php:7.1 @args
}
Set-Alias p pAlias