-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstudio
executable file
·34 lines (31 loc) · 1.56 KB
/
studio
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
#!/usr/bin/env bash
RUN_PATH=$(dirname "$0")
if [ "$1" == "setup" ]; then
cp example.env .env
mkdir -p "$RUN_PATH"/src
mkdir -p "$RUN_PATH"/docker/mysql
sed -i "/HOST_UID=/c\HOST_UID=$(id -u)" "$RUN_PATH"/.env
sed -i "/HOST_GID=/c\HOST_GID=$(id -g)" "$RUN_PATH"/.env
elif [ "$1" == "enable-composer-cache" ]; then
sed -i "s/# COMPOSER_CONFIG/COMPOSER_CONFIG/" "$RUN_PATH"/.env
sed -i "s/# COMPOSER_CACHE_DIR/COMPOSER_CACHE_DIR/" "$RUN_PATH"/.env
sed -i 's/#- "${COMPOSER_CACHE_DIR}/- "${COMPOSER_CACHE_DIR}/' "$RUN_PATH"/docker-compose.yml
sed -i 's/#- "${COMPOSER_CONFIG}/- "${COMPOSER_CONFIG}/' "$RUN_PATH"/docker-compose.yml
elif [ "$1" == "disable-composer-cache" ]; then
sed -i "s/^COMPOSER_CONFIG/# COMPOSER_CONFIG/" "$RUN_PATH"/.env
sed -i "s/^COMPOSER_CACHE_DIR/# COMPOSER_CACHE_DIR/" "$RUN_PATH"/.env
sed -i 's/^- "${COMPOSER_CACHE_DIR}/#- "${COMPOSER_CACHE_DIR}/' "$RUN_PATH"/docker-compose.yml
sed -i 's/^- "${COMPOSER_CONFIG}/#- "${COMPOSER_CONFIG}/' "$RUN_PATH"/docker-compose.yml
elif [ "$1" == "build" ]; then
sudo docker-compose --project-directory "$RUN_PATH" build
elif [ "$1" == "up" ]; then
sudo docker-compose --project-directory "$RUN_PATH" "$@"
elif [ "$1" == "down" ]; then
sudo docker-compose --project-directory "$RUN_PATH" down
elif [ "$1" == "composer" ]; then
sudo docker-compose --project-directory "$RUN_PATH" run --rm php "$@"
elif [ "$1" == "artisan" ]; then
sudo docker-compose --project-directory "$RUN_PATH" exec php php "$@"
elif [ "$1" == "npm" ]; then
sudo docker-compose --project-directory "$RUN_PATH" run --rm "$@"
fi