feat: Add dev Dockerfile & scripts to integrate w/ devcontainers
This commit is contained in:
1 parent
7f5fc417c2
commit
81567b1f82
4 files changed
+253
No files matched your search
Executable
+76
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function print_help_and_exit() {
|
||||
cat <<EOF
|
||||
Generate a devcontainer json object for the current workspace.
|
||||
Usage: gen_devcontainer_json.sh [OPTIONS]
|
||||
|
||||
Options:
|
||||
-u,--user USER The user to add to the image (defaults to the current user)
|
||||
-i,--image The name to give the image (defaults to "USER:spark-dev")
|
||||
-h,--help Print this help message and exit
|
||||
|
||||
EOF
|
||||
exit "$1"
|
||||
}
|
||||
|
||||
|
||||
declare docker_user=""
|
||||
declare image_name=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-i)
|
||||
;&
|
||||
--image)
|
||||
if [[ -z "$2" ]]; then
|
||||
echo "Image (-i,--image) must be non-empty"
|
||||
print_help_and_exit 1
|
||||
fi
|
||||
image_name="$2"
|
||||
shift 2
|
||||
;;
|
||||
-u)
|
||||
;&
|
||||
--user)
|
||||
if [[ -z "$2" ]]; then
|
||||
echo "User (-u,--user) must be non-empty"
|
||||
print_help_and_exit 1
|
||||
fi
|
||||
docker_user="$2"
|
||||
shift 2
|
||||
;;
|
||||
-h)
|
||||
;&
|
||||
--help)
|
||||
print_help_and_exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unexpected argument '$1'"
|
||||
print_help_and_exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$docker_user" ]]; then
|
||||
docker_user="$USER"
|
||||
fi
|
||||
|
||||
if [[ -z "$image_name" ]]; then
|
||||
image_name="${docker_user}:spark-dev"
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
{
|
||||
"image": "$image_name",
|
||||
"remoteUser": "$docker_user",
|
||||
"containerUser": "$docker_user",
|
||||
"initializeCommand": "mkdir -p $HOME/.spark-dev/mounts/spark-dev",
|
||||
"workspaceMount": "source=\${localWorkspaceFolder},target=/home/$docker_user/spark,type=bind",
|
||||
"workspaceFolder": "/home/$docker_user/spark",
|
||||
"mounts": [
|
||||
"source=$HOME/.spark-dev/mounts/spark-dev,target=/home/$docker_user,type=bind"
|
||||
],
|
||||
}
|
||||
|
||||
EOF
|
||||
Reference in new issue
Block a user