2
0
mirror of https://github.com/linka-cloud/d2vm.git synced 2025-12-14 15:03:12 +00:00

refactoring: explicit docker commands

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
2022-04-24 16:27:04 +02:00
parent 20ba409039
commit 085e57a07a
6 changed files with 54 additions and 22 deletions

View File

@@ -132,7 +132,7 @@ COPY hostname /etc/
RUN rm -rf /etc/apk
`
)
exec.Run = exec.RunStdout
exec.SetDebug(true)
tmp := filepath.Join(os.TempDir(), "d2vm-tests", "image-flatten")
require.NoError(t, os.MkdirAll(tmp, perm))
defer os.RemoveAll(tmp)
@@ -140,12 +140,9 @@ RUN rm -rf /etc/apk
require.NoError(t, os.WriteFile(filepath.Join(tmp, "hostname"), []byte("d2vm-flatten-test"), perm))
require.NoError(t, os.WriteFile(filepath.Join(tmp, "resolv.conf"), []byte("nameserver 8.8.8.8"), perm))
require.NoError(t, os.WriteFile(filepath.Join(tmp, "Dockerfile"), []byte(dockerfile), perm))
require.NoError(t, docker.Cmd(ctx, "image", "build", "-t", img, tmp))
defer docker.Cmd(ctx, "image", "rm", img)
require.NoError(t, docker.Build(ctx, img, "", tmp))
defer docker.Remove(ctx, img)
// imgTar := filepath.Join(tmp, img+".tar")
// require.NoError(t, docker.Cmd(ctx, "image", "save", img, "-o", imgTar))
//
imgTmp := filepath.Join(tmp, "image")
i, err := NewImage(ctx, img, imgTmp)