Skip to content

Commit 167af18

Browse files
committed
update docs, add make gen
1 parent 296ab91 commit 167af18

File tree

6 files changed

+24
-7
lines changed

6 files changed

+24
-7
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ develop:
2929
build: scripts/envbuilder-$(GOARCH)
3030
./scripts/build.sh
3131

32+
.PHONY: gen
33+
gen: docs/env-variables.md update-golden-files
34+
3235
.PHONY: update-golden-files
3336
update-golden-files: .gen-golden
3437

@@ -85,4 +88,4 @@ test-images-pull:
8588
docker push localhost:5000/envbuilder-test-ubuntu:latest
8689

8790
.registry-cache/docker/registry/v2/repositories/envbuilder-test-codercom-code-server:
88-
docker push localhost:5000/envbuilder-test-codercom-code-server:latest
91+
docker push localhost:5000/envbuilder-test-codercom-code-server:latest

docs/container-registry-auth.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,19 @@ After you have a configuration that resembles the following:
1414
}
1515
```
1616

17-
`base64` encode the JSON and provide it to envbuilder as the `ENVBUILDER_DOCKER_CONFIG_BASE64` environment variable.
17+
`base64` encode the JSON and provide it to envbuilder as the
18+
`ENVBUILDER_DOCKER_CONFIG_BASE64` environment variable.
1819

19-
Alternatively, if running `envbuilder` in Kubernetes, you can create an `ImagePullSecret` and
20+
Alternatively, the configuration file can be placed in `/.envbuilder/config.json`.
21+
The `DOCKER_CONFIG` environment variable can be used to define a custom path. The
22+
path must either be the path to a directory containing `config.json` or the full
23+
path to the JSON file itself.
24+
25+
> [!NOTE] Providing the docker configuration through other means than the
26+
> `ENVBUILDER_DOCKER_CONFIG_BASE64` environment variable will leave the
27+
> configuration file in the container filesystem. This may be a security risk.
28+
29+
When running `envbuilder` in Kubernetes, you can create an `ImagePullSecret` and
2030
pass it into the pod as a volume mount. This example will work for all registries.
2131

2232
```shell

docs/env-variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
| `--dockerfile-path` | `ENVBUILDER_DOCKERFILE_PATH` | | The relative path to the Dockerfile that will be used to build the workspace. This is an alternative to using a devcontainer that some might find simpler. |
1616
| `--build-context-path` | `ENVBUILDER_BUILD_CONTEXT_PATH` | | Can be specified when a DockerfilePath is specified outside the base WorkspaceFolder. This path MUST be relative to the WorkspaceFolder path into which the repo is cloned. |
1717
| `--cache-ttl-days` | `ENVBUILDER_CACHE_TTL_DAYS` | | The number of days to use cached layers before expiring them. Defaults to 7 days. |
18-
| `--docker-config-base64` | `ENVBUILDER_DOCKER_CONFIG_BASE64` | | The base64 encoded Docker config file that will be used to pull images from private container registries. |
18+
| `--docker-config-base64` | `ENVBUILDER_DOCKER_CONFIG_BASE64` | | The base64 encoded Docker config file that will be used to pull images from private container registries. When this is set, Docker configuration set via the DOCKER_CONFIG environment variable is ignored. |
1919
| `--fallback-image` | `ENVBUILDER_FALLBACK_IMAGE` | | Specifies an alternative image to use when neither an image is declared in the devcontainer.json file nor a Dockerfile is present. If there's a build failure (from a faulty Dockerfile) or a misconfiguration, this image will be the substitute. Set ExitOnBuildFailure to true to halt the container if the build faces an issue. |
2020
| `--exit-on-build-failure` | `ENVBUILDER_EXIT_ON_BUILD_FAILURE` | | Terminates the container upon a build failure. This is handy when preferring the FALLBACK_IMAGE in cases where no devcontainer.json or image is provided. However, it ensures that the container stops if the build process encounters an error. |
2121
| `--force-safe` | `ENVBUILDER_FORCE_SAFE` | | Ignores any filesystem safety checks. This could cause serious harm to your system! This is used in cases where bypass is needed to unblock customers. |

options/options.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,9 @@ func (o *Options) CLI() serpent.OptionSet {
277277
Env: WithEnvPrefix("DOCKER_CONFIG_BASE64"),
278278
Value: serpent.StringOf(&o.DockerConfigBase64),
279279
Description: "The base64 encoded Docker config file that " +
280-
"will be used to pull images from private container registries.",
280+
"will be used to pull images from private container registries. " +
281+
"When this is set, Docker configuration set via the DOCKER_CONFIG " +
282+
"environment variable is ignored.",
281283
},
282284
{
283285
Flag: "fallback-image",

options/testdata/options.golden

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ OPTIONS:
4747

4848
--docker-config-base64 string, $ENVBUILDER_DOCKER_CONFIG_BASE64
4949
The base64 encoded Docker config file that will be used to pull images
50-
from private container registries.
50+
from private container registries. When this is set, Docker
51+
configuration set via the DOCKER_CONFIG environment variable is
52+
ignored.
5153

5254
--dockerfile-path string, $ENVBUILDER_DOCKERFILE_PATH
5355
The relative path to the Dockerfile that will be used to build the

scripts/docsgen/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ func main() {
1616
if err != nil {
1717
panic(err)
1818
}
19-
fmt.Printf("%s updated successfully with the latest flags!", path)
19+
fmt.Printf("%s updated successfully with the latest flags!\n", path)
2020
}

0 commit comments

Comments
 (0)