From 7003eed288e884e8cec4cb7c0de2ecfe8673ce61 Mon Sep 17 00:00:00 2001 From: Fabian Kramm Date: Thu, 7 Sep 2023 18:34:35 +0200 Subject: [PATCH] fix: workdir issue --- .gitignore | 1 + Dockerfile | 2 +- cmd/build.go | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 9887575..8d46ce6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /test /tools /dist +/dockerless diff --git a/Dockerfile b/Dockerfile index 7b7f992..1c50a93 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ COPY --from=busybox /bin /.dockerless/bin RUN ["/.dockerless/bin/sh", "-c", "echo 'root:x:0:0:root:/root:/.dockerless/bin/sh' > /etc/passwd && chmod 666 /etc/passwd"] -WORKDIR /.dockerless +WORKDIR / ENTRYPOINT ["/.dockerless/bin/sh", "-c"] diff --git a/cmd/build.go b/cmd/build.go index bc09fcd..a15cc01 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -124,7 +124,7 @@ func (cmd *BuildCmd) build() (v1.Image, error) { } // change dir before building - err = os.Chdir(cmd.Context) + err = os.Chdir("/") if err != nil { return nil, fmt.Errorf("change dir: %w", err) } @@ -161,7 +161,7 @@ func (cmd *BuildCmd) build() (v1.Image, error) { if err != nil { // add a passwd as other we won't be able to exec into this container if addPwdErr := addPasswd(); addPwdErr != nil { - return nil, fmt.Errorf("build and add passwd error occurred: %w --- %w", err, addPwdErr) + return nil, fmt.Errorf("build and add passwd error occurred: %w --- %v", err, addPwdErr) } return nil, fmt.Errorf("build error: %w", err)