-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Embed the envbuilder binary in images #216
Comments
I think it is already done. When I try to run envbuilder inside a container from an integration test, it works and it looks like the binary is already in the image. execContainer(t, ctr, "/.envbuilder/bin/envbuilder --help")
|
^ It needs to be in the built and pushed image. See the acceptance criteria I added in the issue description. |
Looks like it is already there. Here is the testing that I'm using to check that. func TestEmbedBinaryImage(t *testing.T) {
t.Parallel()
srv := createGitServer(t, gitServerOptions{
files: map[string]string{
".devcontainer/Dockerfile": fmt.Sprintf("FROM %s\nRUN date --utc > /root/date.txt", testImageAlpine),
".devcontainer/devcontainer.json": `{
"name": "Test",
"build": {
"dockerfile": "Dockerfile"
},
}`,
},
})
testReg := setupInMemoryRegistry(t, setupInMemoryRegistryOpts{})
testRepo := testReg + "/test"
ref, err := name.ParseReference(testRepo + ":latest")
require.NoError(t, err)
_, err = runEnvbuilder(t, options{env: []string{
envbuilderEnv("GIT_URL", srv.URL),
envbuilderEnv("CACHE_REPO", testRepo),
envbuilderEnv("PUSH_IMAGE", "1"),
}})
require.NoError(t, err)
_, err = remote.Image(ref)
require.NoError(t, err, "expected image to be present after build + push")
ctr, err := runEnvbuilder(t, options{env: []string{
envbuilderEnv("FALLBACK_IMAGE", ref.String()),
}})
require.NoError(t, err)
out := execContainer(t, ctr, "[[ -f \"/.envbuilder/bin/envbuilder\" ]] && echo \"exists\"")
require.Equal(t, "exists", strings.TrimSpace(out))
} |
Related to the following statement:
Since we control where the binary is, do we need to lookup? Asking because we would have to install |
I don't think it's unreasonable to require the binary to be at a specific path. |
fixed by #234 |
Depends on #197
As part of #128, we want to embed the envbuilder binary in container images that are pushed to a registry (see #213 for the push implementation).
This could be as simple as appending
COPY /.envbuilder/bin/envbuilder /.envbuilder/bin/envbuilder
to the Dockerfile. The binary could be located elsewhere too, so a lookup may be necessary.This will embed an eventually stale envbuilder binary in the image, but we consider this OK as our recommendation is to lock the envbuilder version, updating it will result in a new build.
Acceptance Criteria:
ENVBUILDER_CACHE_REPO=localhost:5000/envbuilder-cache
or similar (after feat: push final image to cache repo #197 is merged)envbuilder
binary is present in the same location in the resulting imageThe text was updated successfully, but these errors were encountered: