Last active
October 3, 2017 05:11
-
-
Save Roulette/bb7e367844996623323e6bf761dfe10a to your computer and use it in GitHub Desktop.
Docker Proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This is the proxy. You'll want to configure your IDE settings in such way that it points to this file instead of the actual binary. | |
# This file has to be copy-pasted for each binary. | |
# For example, the VS Code Reason plugin needs paths to numerous binaries, such as opam, refmt and so on. | |
# You would need to have a file such as this one for each of them and replacing "ORIGINAL_COMMAND" with "opam" or "refmt". | |
# The "$@" is a forward of all parameters | |
# set -euo pipefail takes care of weird permission issues. | |
set -euo pipefail | |
docker exec CONTAINER_NAME ORIGINAL_COMMAND "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This starts the actual container. Execute this prior to opening your IDE. | |
# The script should live at the root of your project. | |
# $(pwd):$(pwd) is a 1:1 mapping of the project to the container | |
# -u $UID takes care of weird permission issues. | |
CONT_NAME="CONTAINER_NAME" | |
docker rm -f ${CONT_NAME} | |
docker run -t -d -v $(pwd):$(pwd) \ | |
-u $UID \ | |
--name ${CONT_NAME} \ | |
IMAGE_NAME | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment