forked from beerandcodeteam/adoteumdev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sail
executable file
·65 lines (47 loc) · 1.33 KB
/
sail
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
UNAMEOUT="$(uname -s)"
WHITE='\033[1;37m'
NC='\033[0m'
# Verify operating system is supported...
case "${UNAMEOUT}" in
Linux*) MACHINE=linux;;
Darwin*) MACHINE=mac;;
*) MACHINE="UNKNOWN"
esac
if [ "$MACHINE" == "UNKNOWN" ]; then
echo "Unsupported operating system [$(uname -s)]. Laravel Sail supports macOS, Linux, and Windows (WSL2)." >&2
exit 1
fi
# Ensure that Docker is running...
if ! docker info > /dev/null 2>&1; then
echo -e "${WHITE}Docker is not running.${NC}" >&2
exit 1
fi
# Source the ".env" file so Laravel's environment variables are available...
if [ -f ./.env ]; then
source ./.env
fi
if [ "$1" == "config" ]; then
ENVFILE='./.env'
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/opt \
-w /opt \
laravelsail/php80-composer:latest \
composer install --ignore-platform-reqs
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/usr/src/app \
-w /usr/src/app \
node:16-alpine \
npm install
if [ ! -f $ENVFILE ]; then
cp .env.example .env
fi
elif [ "$1" == "init" ]; then
./vendor/bin/sail up --build --force-recreate -d
elif [ "$1" == "test" ]; then
./vendor/bin/sail art test -p
else
./vendor/bin/sail "$@"
fi