-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathlaraprep.sh
executable file
·64 lines (49 loc) · 1.44 KB
/
laraprep.sh
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
60
61
62
63
64
#!/usr/bin/env bash
# LaraPrep, a simple script for a lazy developer.
# Wrote by Francesco Malatesta - Dec 10, 2016 - Last Update Sep 25, 2020
function docker_prep {
# export current user id
USER_ID=$(id -u -r)
USER_NAME=$(whoami)
echo "Creating Project: ${PROJECT_NAME} with laravel/laravel${PROJECT_VERSION} - PHP: ${PHP_VERSION}"
echo "127.0.0.1 ${PROJECT_HOSTNAME}" | sudo tee -a $HOSTS_PATH > /dev/null
docker run -u $USER_ID --rm -it \
-v $(pwd):/opt \
-w /opt shippingdocker/php-composer:$PHP_VERSION \
composer create-project laravel/laravel$PROJECT_VERSION $PROJECT_NAME
docker run -u $USER_ID --rm -it \
-v $(pwd):/opt \
-w /opt/$PROJECT_NAME shippingdocker/php-composer:$PHP_VERSION \
composer require shipping-docker/vessel
docker run -u $USER_ID --rm -it \
-v $(pwd):/opt \
-w /opt/$PROJECT_NAME shippingdocker/php-composer:$PHP_VERSION \
php artisan vendor:publish --provider="Vessel\VesselServiceProvider"
cd $PROJECT_NAME
bash vessel init
./vessel start
printf "\nConfigured ${PROJECT_HOSTNAME}! Have fun :)\n"
}
if [ $? -ne 0 ];
then
exit 1
fi
if [ -z "$1" ]
then
echo "ERROR: Please specify a name for the project folder."
exit
fi
PHP_VERSION="$3"
if [ -z "$3" ]
then
PHP_VERSION="latest"
fi
PROJECT_VERSION="=$2"
if [ -z "$2" ]
then
PROJECT_VERSION=""
fi
PROJECT_NAME="$1"
PROJECT_HOSTNAME="$1.test"
HOSTS_PATH="/etc/hosts"
docker_prep