Skip to content

Instantly share code, notes, and snippets.

@Roulette
Last active October 3, 2017 05:11
Show Gist options
  • Save Roulette/bb7e367844996623323e6bf761dfe10a to your computer and use it in GitHub Desktop.
Save Roulette/bb7e367844996623323e6bf761dfe10a to your computer and use it in GitHub Desktop.
Docker Proxy
#!/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 "$@"
#!/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