Skip to content

Commit

Permalink
chore(README.md): add instructions for local iteration without a Git …
Browse files Browse the repository at this point in the history
…repo (#342)

(cherry picked from commit 9b83cf5)
  • Loading branch information
johnstcn authored and mafredri committed Oct 2, 2024
1 parent d9fcd53 commit feec224
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ docker run -it --rm \
Edit `.devcontainer/Dockerfile` to add `htop`:

```bash
$ vim .devcontainer/Dockerfile
vim .devcontainer/Dockerfile
```

```diff
Expand All @@ -53,6 +53,39 @@ Exit the container, and re-run the `docker run` command... after the build compl
> If you need to bypass this behavior for any reason, you can bypass this safety check by setting
> `ENVBUILDER_FORCE_SAFE=true`.
If you don't have a remote Git repo or you want to quickly iterate with some
local files, simply omit `ENVBUILDER_GIT_URL` and instead mount the directory
containing your code to `/workspaces/empty` inside the Envbuilder container.

For example:

```shell
# Create a sample Devcontainer and Dockerfile in the current directory
printf '{"build": { "dockerfile": "Dockerfile"}}' > devcontainer.json
printf 'FROM debian:bookworm\nRUN apt-get update && apt-get install -y cowsay' > Dockerfile

# Run envbuilder with the current directory mounted into `/workspaces/empty`.
# The instructions to add /usr/games to $PATH have been omitted for brevity.
docker run -it --rm -e ENVBUILDER_INIT_SCRIPT='bash' -v $PWD:/workspaces/empty ghcr.io/coder/envbuilder:latest
```

Alternatively, if you prefer to mount your project files elsewhere, tell
Envbuilder where to find them by specifying `ENVBUILDER_WORKSPACE_FOLDER`:

```shell
docker run -it --rm -e ENVBUILDER_INIT_SCRIPT='bash ' -e ENVBUILDER_WORKSPACE_FOLDER=/src -v $PWD:/src ghcr.io/coder/envbuilder:latest
```

By default, Envbuilder will look for a `devcontainer.json` or `Dockerfile` in
both `${ENVBUILDER_WORKSPACE_FOLDER}` and `${ENVBUILDER_WORKSPACE_FOLDER}/.devcontainer`.
You can control where it looks with `ENVBUILDER_DEVCONTAINER_DIR` if needed.

```shell
ls build/
Dockerfile devcontainer.json
docker run -it --rm -e ENVBUILDER_INIT_SCRIPT='bash' -e ENVBUILDER_DEVCONTAINER_DIR=build -v $PWD:/src ghcr.io/coder/envbuilder:latest
```

## Usage with Coder

Coder provides sample
Expand Down

0 comments on commit feec224

Please sign in to comment.