-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathx
More file actions
executable file
·54 lines (51 loc) · 1.39 KB
/
Copy pathx
File metadata and controls
executable file
·54 lines (51 loc) · 1.39 KB
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
#!/usr/bin/env bash
set -a
. ./.env
set +a
if [[ "$#" -eq 0 ]]
then
# During the project setup stage, removing `--wait` displays the container
# startup log and should help with troubleshooting.
docker compose up --remove-orphans --wait
docker compose logs -f
docker compose down
elif [[ "$1" == '--detach' ]]
then
docker compose up --remove-orphans --wait
elif [[ "$1" == 'run' ]]
then
docker run --rm -it \
-u "node" \
-e "NPM_CONFIG_PREFIX=${NPM_CONFIG_PREFIX}" \
-e "PATH=${REMOTE_PATH}:${NPM_CONFIG_PREFIX}/bin" \
-v "${PWD}/app:${APP_DIR}" \
-v "${PWD}/volumes/npm-global:${NPM_CONFIG_PREFIX}" \
-w "${APP_DIR}" \
"node:${NODE_IMAGE_TAG}" \
"${@:2}" # pass in all but the first arguments
elif [[ "$1" == 'remote-path' ]]
then
docker run --rm -it \
-u "node" \
"node:${NODE_IMAGE_TAG}" \
bash -c 'echo $PATH'
elif [[ "$1" == '--postgres' ]]
then
docker exec -it \
"${COMPOSE_PROJECT_NAME}-postgres-1" \
"${@:2}" # pass in all but the first arguments
elif [[ "$1" == '--adminer' ]]
then
docker exec -it \
"${COMPOSE_PROJECT_NAME}-adminer-1" \
"${@:2}" # pass in all but the first arguments
elif [[ "$1" != -* ]]
then
docker exec -it \
-e "PATH=${REMOTE_PATH}:${NPM_CONFIG_PREFIX}/bin" \
"${COMPOSE_PROJECT_NAME}-app-1" \
"$@" # pass in all arguments
else
echo 'Invalid argument(s)!'
fi
exit 0