generated from bbarker/purescript-concur-adventure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpsc.sh
executable file
·59 lines (49 loc) · 1.77 KB
/
psc.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
#!/usr/bin/env bash
#
# If you found this in a repository other than
# purescript-hodgepodge, know that it was likely copied or modified
# from the script of the same name located at
# https://github.com/bbarker/purescript-hodgepodge
#
# You can find more information there about this script.
#
CONTAINER_NAME="PsHodge-$(basename $(pwd))"
CID_FILE=dev_container.cid
: "${IMG_NAME:=purescript-hodgepodge}"
: "${IMG_VER:=latest}"
# Set this to the empty string to use locally built image:
if ! [[ -v "DHUB_PREFIX" ]]; then
: "${DHUB_PREFIX:=bbarker/}"
fi
# If really an empty string, then we interpret as using a local image
# and do not pull:
if ! [ -z "$DHUB_PREFIX" ]; then
docker pull "${DHUB_PREFIX}${IMG_NAME}:${IMG_VER}"
fi
# Make these directories so docker (root) does not!
mkdir -p ~/.pulp
mkdir -p ~/.npm
mkdir -p ~/.npm-packages
mkdir -p ~/.cache
touch ~/.pulp/github-oauth-token
rm -f "$CID_FILE"
sleep 1 && docker exec --user root $(cat "$CID_FILE") /bin/sh -c "chown $USER:node /home/$USER" &
docker run --rm -ti \
--cidfile ./"$CID_FILE" \
--volume /etc/passwd:/etc/passwd:ro \
--volume "$PWD":/wd \
--volume "$HOME/.gitconfig:$HOME/.gitconfig:ro" \
--volume "$HOME/.ssh:$HOME/.ssh:ro" \
--volume "$HOME/.pulp:$HOME/.pulp" \
--volume "$HOME/.cache:$HOME/.cache" \
--volume "$HOME/.npmrc:$HOME/.npmrc" \
--volume "$HOME/.npm:$HOME/.npm" \
--volume "$HOME/.npm-packages:$HOME/.npm-packages" \
--name "$CONTAINER_NAME" \
--user "$UID" \
--workdir /wd \
-e "XDG_CONFIG_HOME=/wd/.xdg_config_home" \
-e "XDG_DATA_HOME=/wd/.xdg_data_home" \
"${DHUB_PREFIX}${IMG_NAME}:${IMG_VER}" "$@"
# Add this before the last line (image name) for debugging:
# --entrypoint "/bin/bash" \