|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# |
| 4 | +# If you found this in a repository other than |
| 5 | +# purescript-hodgepodge, know that it was likely copied or modified |
| 6 | +# from the script of the same name located at |
| 7 | +# https://github.com/bbarker/purescript-hodgepodge |
| 8 | +# |
| 9 | +# You can find more information there about this script. |
| 10 | +# |
| 11 | + |
| 12 | + |
| 13 | +: "${IMG_NAME:=purescript-hodgepodge}" |
| 14 | +: "${IMG_VER:=latest}" |
| 15 | +# Set this to the empty string to use locally built image: |
| 16 | +if ! [[ -v "DHUB_PREFIX" ]]; then |
| 17 | + : "${DHUB_PREFIX:=bbarker/}" |
| 18 | +fi |
| 19 | + |
| 20 | +# If really an empty string, then we interpret as using a local image |
| 21 | +# and do not pull: |
| 22 | +if ! [ -z "$DHUB_PREFIX" ]; then |
| 23 | + docker pull "${DHUB_PREFIX}${IMG_NAME}:${IMG_VER}" |
| 24 | +fi |
| 25 | + |
| 26 | +# Make these directories so docker (root) does not! |
| 27 | +mkdir -p ~/.pulp |
| 28 | +mkdir -p ~/.npm |
| 29 | +mkdir -p ~/.npm-packages |
| 30 | +mkdir -p ~/.cache |
| 31 | +touch ~/.pulp/github-oauth-token |
| 32 | + |
| 33 | + |
| 34 | +docker run --rm -ti \ |
| 35 | + --volume /etc/passwd:/etc/passwd:ro \ |
| 36 | + --volume "$PWD":/wd \ |
| 37 | + --volume "$HOME/.gitconfig:$HOME/.gitconfig:ro" \ |
| 38 | + --volume "$HOME/.ssh:$HOME/.ssh:ro" \ |
| 39 | + --volume "$HOME/.pulp:$HOME/.pulp" \ |
| 40 | + --volume "$HOME/.cache:$HOME/.cache" \ |
| 41 | + --volume "$HOME/.npmrc:$HOME/.npmrc" \ |
| 42 | + --volume "$HOME/.npm:$HOME/.npm" \ |
| 43 | + --volume "$HOME/.npm-packages:$HOME/.npm-packages" \ |
| 44 | + --user "$UID" \ |
| 45 | + --workdir /wd \ |
| 46 | + -e "XDG_CONFIG_HOME=/wd/.xdg_config_home" \ |
| 47 | + -e "XDG_DATA_HOME=/wd/.xdg_data_home" \ |
| 48 | + "${DHUB_PREFIX}${IMG_NAME}:${IMG_VER}" "$@" |
| 49 | + |
| 50 | +# Add this before the last line (image name) for debugging: |
| 51 | +# --entrypoint "/bin/bash" \ |
0 commit comments