feat: Add dev Dockerfile & scripts to integrate w/ devcontainers

This commit is contained in:
John Colvin committed 2023-03-31 04:59:33 +00:00
1 parent 7f5fc417c2
commit 81567b1f82
4 files changed
+253

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
# Spark Dev Container
## How to create a Spark VS Code Devcontainer
<a name="build_image"></a>
## 1. Build the Docker image
Run the script `build.sh` located in this directory to build the image
```
build.sh
```
***Notes***
* Builds an image named `$USER:spark-dev`
* Adds a user to the image with the same name/uid/gid as the current user so
it has proper file permissions in mounted directories
* Run `build.sh --help` to see available options
<a name="gen_devcontainer_json"></a>
## 2. Generate a devcontainer.json
Run the script `gen_devcontainer.sh` located in this directory to create a devcontainer.json file.<br>
***Note:** The file path must be `<repo_dir>/.devcontainer/devcontainer.json`*
```
# Dump `gen_devcontainer.sh` output to devcontainer.json
gen_devcontainer.sh > $workspaceFolder/.devcontainer/devcontainer.json
```
***Notes***
* Mounts the following directories (`<container_path>:<host_path>`):
- `/home/<user>:/home/<user>/.spark-dev/mounts/<container_name>`
- `/home/<user>/spark:/path/to/this/repo`
* Run `gen_devcontainer.sh --help` to see available options
<a name="open_vscode_in_container"></a>
## 3. Open VS Code in Container
1. Launch **VS Code** and open the repo folder on the host machine.
1. Run **Dev Containers: Open Folder in Container** from the command palette.<br>
***Notes**
* The container stops when you close VS Code. All processes, including
`sparkd`, will be suspened until you open the workspace again (or manually
restart the container).