Skip to content

Commit d43350f

Browse files
authored
chore: update README with ENVBUILDER_ prefix (#203)
1 parent 572fae7 commit d43350f

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

README.md

+39-39
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ Build development environments from a Dockerfile on Docker, Kubernetes, and Open
2222

2323
## Quickstart
2424

25-
The easiest way to get started is to run the `envbuilder` Docker container that clones a repository, builds the image from a Dockerfile, and runs the `$INIT_SCRIPT` in the freshly built container.
25+
The easiest way to get started is to run the `envbuilder` Docker container that clones a repository, builds the image from a Dockerfile, and runs the `$ENVBUILDER_INIT_SCRIPT` in the freshly built container.
2626

2727
> `/tmp/envbuilder` directory persists demo data between commands. You can choose a different directory.
2828
2929
```bash
3030
docker run -it --rm \
3131
-v /tmp/envbuilder:/workspaces \
32-
-e GIT_URL=https://github.com/coder/envbuilder-starter-devcontainer \
33-
-e INIT_SCRIPT=bash \
32+
-e ENVBUILDER_GIT_URL=https://github.com/coder/envbuilder-starter-devcontainer \
33+
-e ENVBUILDER_INIT_SCRIPT=bash \
3434
ghcr.io/coder/envbuilder
3535
```
3636

@@ -51,14 +51,14 @@ Exit the container, and re-run the `docker run` command... after the build compl
5151
> Envbuilder performs destructive filesystem operations! To guard against accidental data
5252
> loss, it will refuse to run if it detects that KANIKO_DIR is not set to a specific value.
5353
> If you need to bypass this behavior for any reason, you can bypass this safety check by setting
54-
> `FORCE_SAFE=true`.
54+
> `ENVBUILDER_FORCE_SAFE=true`.
5555
5656
### Git Branch Selection
5757

58-
Choose a branch using `GIT_URL` with a _ref/heads_ reference. For instance:
58+
Choose a branch using `ENVBUILDER_GIT_URL` with a _ref/heads_ reference. For instance:
5959

6060
```
61-
GIT_URL=https://github.com/coder/envbuilder-starter-devcontainer/#refs/heads/my-feature-branch
61+
ENVBUILDER_GIT_URL=https://github.com/coder/envbuilder-starter-devcontainer/#refs/heads/my-feature-branch
6262
```
6363

6464
## Container Registry Authentication
@@ -77,7 +77,7 @@ After you have a configuration that resembles the following:
7777
}
7878
```
7979

80-
`base64` encode the JSON and provide it to envbuilder as the `DOCKER_CONFIG_BASE64` environment variable.
80+
`base64` encode the JSON and provide it to envbuilder as the `ENVBUILDER_DOCKER_CONFIG_BASE64` environment variable.
8181

8282
Alternatively, if running `envbuilder` in Kubernetes, you can create an `ImagePullSecret` and
8383
pass it into the pod as a volume mount. This example will work for all registries.
@@ -131,7 +131,7 @@ ewoJImF1dGhzIjogewoJCSJodHRwczovL2luZGV4LmRvY2tlci5pby92MS8iOiB7CgkJCSJhdXRoIjog
131131
Provide the encoded JSON config to envbuilder:
132132

133133
```env
134-
DOCKER_CONFIG_BASE64=ewoJImF1dGhzIjogewoJCSJodHRwczovL2luZGV4LmRvY2tlci5pby92MS8iOiB7CgkJCSJhdXRoIjogImJhc2U2NCBlbmNvZGVkIHRva2VuIgoJCX0KCX0KfQo=
134+
ENVBUILDER_DOCKER_CONFIG_BASE64=ewoJImF1dGhzIjogewoJCSJodHRwczovL2luZGV4LmRvY2tlci5pby92MS8iOiB7CgkJCSJhdXRoIjogImJhc2U2NCBlbmNvZGVkIHRva2VuIgoJCX0KCX0KfQo=
135135
```
136136

137137
### Docker-in-Docker
@@ -145,17 +145,17 @@ Two methods of authentication are supported:
145145

146146
### HTTP Authentication
147147

148-
If the `GIT_URL` supplied starts with `http://` or `https://`, envbuilder will
149-
supply HTTP basic authentication using `GIT_USERNAME` and `GIT_PASSWORD`, if set.
148+
If `ENVBUILDER_GIT_URL` starts with `http://` or `https://`, envbuilder will
149+
authenticate with `ENVBUILDER_GIT_USERNAME` and `ENVBUILDER_GIT_PASSWORD`, if set.
150150

151151
For access token-based authentication, follow the following schema (if empty, there's no need to provide the field):
152152

153-
| Provider | `GIT_USERNAME` | `GIT_PASSWORD` |
154-
| ------------ | -------------- | -------------- |
155-
| GitHub | [access-token] | |
156-
| GitLab | oauth2 | [access-token] |
157-
| BitBucket | x-token-auth | [access-token] |
158-
| Azure DevOps | [access-token] | |
153+
| Provider | `ENVBUILDER_GIT_USERNAME` | `ENVBUILDER_GIT_PASSWORD` |
154+
| ------------ | ------------------------- | ------------------------- |
155+
| GitHub | [access-token] | |
156+
| GitLab | oauth2 | [access-token] |
157+
| BitBucket | x-token-auth | [access-token] |
158+
| Azure DevOps | [access-token] | |
159159

160160
If using envbuilder inside of [Coder](https://github.com/coder/coder), you can use the `coder_external_auth` Terraform resource to automatically provide this token on workspace creation:
161161

@@ -166,27 +166,27 @@ data "coder_external_auth" "github" {
166166
167167
resource "docker_container" "dev" {
168168
env = [
169-
GIT_USERNAME = data.coder_external_auth.github.access_token,
169+
ENVBUILDER_GIT_USERNAME = data.coder_external_auth.github.access_token,
170170
]
171171
}
172172
```
173173

174174
### SSH Authentication
175175

176-
If the `GIT_URL` supplied does not start with `http://` or `https://`,
176+
If `ENVBUILDER_GIT_URL` does not start with `http://` or `https://`,
177177
envbuilder will assume SSH authentication. You have the following options:
178178

179-
1. Public/Private key authentication: set `GIT_SSH_KEY_PATH` to the path of an
179+
1. Public/Private key authentication: set `ENVBUILDER_GIT_SSH_KEY_PATH` to the path of an
180180
SSH private key mounted inside the container. Envbuilder will use this SSH
181181
key to authenticate. Example:
182182

183183
```bash
184184
docker run -it --rm \
185185
-v /tmp/envbuilder:/workspaces \
186-
-e [email protected]:path/to/private/repo.git \
187-
-e GIT_SSH_KEY_PATH=/.ssh/id_rsa \
186+
-e [email protected]:path/to/private/repo.git \
187+
-e ENVBUILDER_INIT_SCRIPT=bash \
188+
-e ENVBUILDER_GIT_SSH_KEY_PATH=/.ssh/id_rsa \
188189
-v /home/user/id_rsa:/.ssh/id_rsa \
189-
-e INIT_SCRIPT=bash \
190190
ghcr.io/coder/envbuilder
191191
```
192192

@@ -195,8 +195,8 @@ envbuilder will assume SSH authentication. You have the following options:
195195
```bash
196196
docker run -it --rm \
197197
-v /tmp/envbuilder:/workspaces \
198-
-e GIT_URL[email protected]:path/to/private/repo.git \
199-
-e INIT_SCRIPT=bash \
198+
-e ENVBUILDER_GIT_URL[email protected]:path/to/private/repo.git \
199+
-e ENVBUILDER_INIT_SCRIPT=bash \
200200
-e SSH_AUTH_SOCK=/tmp/ssh-auth-sock \
201201
-v $SSH_AUTH_SOCK:/tmp/ssh-auth-sock \
202202
ghcr.io/coder/envbuilder
@@ -209,18 +209,18 @@ envbuilder will assume SSH authentication. You have the following options:
209209

210210
## Layer Caching
211211

212-
Cache layers in a container registry to speed up builds. To enable caching, [authenticate with your registry](#container-registry-authentication) and set the `CACHE_REPO` environment variable.
212+
Cache layers in a container registry to speed up builds. To enable caching, [authenticate with your registry](#container-registry-authentication) and set the `ENVBUILDER_CACHE_REPO` environment variable.
213213

214214
```bash
215215
CACHE_REPO=ghcr.io/coder/repo-cache
216216
```
217217

218-
To experiment without setting up a registry, use `LAYER_CACHE_DIR`:
218+
To experiment without setting up a registry, use `ENVBUILDER_LAYER_CACHE_DIR`:
219219

220220
```bash
221221
docker run -it --rm \
222222
-v /tmp/envbuilder-cache:/cache \
223-
-e LAYER_CACHE_DIR=/cache
223+
-e ENVBUILDER_LAYER_CACHE_DIR=/cache
224224
...
225225
```
226226

@@ -243,7 +243,7 @@ docker run --rm \
243243
# Run envbuilder with the local image cache.
244244
docker run -it --rm \
245245
-v /tmp/kaniko-cache:/image-cache:ro \
246-
-e BASE_IMAGE_CACHE_DIR=/image-cache
246+
-e ENVBUILDER_BASE_IMAGE_CACHE_DIR=/image-cache
247247
```
248248

249249
In Kubernetes, you can pre-populate a persistent volume with the same warmer image, then mount it into many workspaces with the [`ReadOnlyMany` access mode](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes).
@@ -252,38 +252,38 @@ A sample script to pre-fetch a number of images can be viewed [here](./examples/
252252

253253
## Setup Script
254254

255-
The `SETUP_SCRIPT` environment variable dynamically configures the user and init command (PID 1) after the container build process.
255+
The `ENVBUILDER_SETUP_SCRIPT` environment variable dynamically configures the user and init command (PID 1) after the container build process.
256256

257257
> [!NOTE]
258-
> `TARGET_USER` is passed to the setup script to specify who will execute `INIT_COMMAND` (e.g., `code`).
258+
> `TARGET_USER` is passed to the setup script to specify who will execute `ENVBUILDER_INIT_COMMAND` (e.g., `code`).
259259
260260
Write the following to `$ENVBUILDER_ENV` to shape the container's init process:
261261

262-
- `TARGET_USER`: Identifies the `INIT_COMMAND` executor (e.g.`root`).
263-
- `INIT_COMMAND`: Defines the command executed by `TARGET_USER` (e.g. `/bin/bash`).
264-
- `INIT_ARGS`: Arguments provided to `INIT_COMMAND` (e.g. `-c 'sleep infinity'`).
262+
- `TARGET_USER`: Identifies the `ENVBUILDER_INIT_COMMAND` executor (e.g.`root`).
263+
- `ENVBUILDER_INIT_COMMAND`: Defines the command executed by `TARGET_USER` (e.g. `/bin/bash`).
264+
- `ENVBUILDER_INIT_ARGS`: Arguments provided to `ENVBUILDER_INIT_COMMAND` (e.g. `-c 'sleep infinity'`).
265265

266266
```bash
267267
# init.sh - change the init if systemd exists
268268
if command -v systemd >/dev/null; then
269269
echo "Hey 👋 $TARGET_USER"
270-
echo INIT_COMMAND=systemd >> $ENVBUILDER_ENV
270+
echo ENVBUILDER_INIT_COMMAND=systemd >> $ENVBUILDER_ENV
271271
else
272-
echo INIT_COMMAND=bash >> $ENVBUILDER_ENV
272+
echo ENVBUILDER_INIT_COMMAND=bash >> $ENVBUILDER_ENV
273273
fi
274274

275275
# run envbuilder with the setup script
276276
docker run -it --rm \
277277
-v ./:/some-dir \
278-
-e SETUP_SCRIPT=/some-dir/init.sh \
278+
-e ENVBUILDER_SETUP_SCRIPT=/some-dir/init.sh \
279279
...
280280
```
281281

282282
## Custom Certificates
283283

284-
- [`SSL_CERT_FILE`](https://go.dev/src/crypto/x509/root_unix.go#L19): Specifies the path to an SSL certificate.
285-
- [`SSL_CERT_DIR`](https://go.dev/src/crypto/x509/root_unix.go#L25): Identifies which directory to check for SSL certificate files.
286-
- `SSL_CERT_BASE64`: Specifies a base64-encoded SSL certificate that will be added to the global certificate pool on start.
284+
- [`ENVBUILDER_SSL_CERT_FILE`](https://go.dev/src/crypto/x509/root_unix.go#L19): Specifies the path to an SSL certificate.
285+
- [`ENVBUILDER_SSL_CERT_DIR`](https://go.dev/src/crypto/x509/root_unix.go#L25): Identifies which directory to check for SSL certificate files.
286+
- `ENVBUILDER_SSL_CERT_BASE64`: Specifies a base64-encoded SSL certificate that will be added to the global certificate pool on start.
287287

288288
# Local Development
289289

docs/docker.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ docker run -it --rm \
2323
-e ENVBUILDER_GIT_URL=https://github.com/coder/envbuilder \
2424
-e ENVBUILDER_DEVCONTAINER_DIR=/workspaces/envbuilder/examples/docker/01_dood \
2525
-e ENVBUILDER_INIT_SCRIPT=bash \
26-
-v /var/run/docker.socket:/var/run/docker.socket \
26+
-v /var/run/docker.sock:/var/run/docker.sock \
2727
ghcr.io/coder/envbuilder:latest
2828
```
2929

0 commit comments

Comments
 (0)