diff --git a/pkg/build/helpers.go b/pkg/build/helpers.go index 0c374a8..b744229 100644 --- a/pkg/build/helpers.go +++ b/pkg/build/helpers.go @@ -212,6 +212,8 @@ var containerfileTemplate = template.Must(template.New("containerfile"). Parse(` FROM {{ .Image }} +WORKDIR /home/application/current + COPY ./application.tar.gz /home/application/archive.tar.gz RUN --mount=type=secret,id=tsuru-app-envvars,target=/var/run/secrets/envs.sh,uid=1000,gid=1000 \ @@ -221,8 +223,6 @@ RUN --mount=type=secret,id=tsuru-app-envvars,target=/var/run/secrets/envs.sh,uid && { sh -lc {{ shellQuote . }}; } \ {{- end }} && : - -WORKDIR /home/application/current `)) type BuildResponseOutputWriter struct { diff --git a/pkg/build/helpers_test.go b/pkg/build/helpers_test.go index e90efcb..667e44f 100644 --- a/pkg/build/helpers_test.go +++ b/pkg/build/helpers_test.go @@ -317,14 +317,14 @@ func TestBuildContainerfile(t *testing.T) { expected: ` FROM tsuru/scratch:latest +WORKDIR /home/application/current + COPY ./application.tar.gz /home/application/archive.tar.gz RUN --mount=type=secret,id=tsuru-app-envvars,target=/var/run/secrets/envs.sh,uid=1000,gid=1000 \ [ -f /var/run/secrets/envs.sh ] && . /var/run/secrets/envs.sh \ && /var/lib/tsuru/deploy archive file:///home/application/archive.tar.gz \ && : - -WORKDIR /home/application/current `, }, { @@ -338,6 +338,8 @@ WORKDIR /home/application/current expected: ` FROM tsuru/scratch:latest +WORKDIR /home/application/current + COPY ./application.tar.gz /home/application/archive.tar.gz RUN --mount=type=secret,id=tsuru-app-envvars,target=/var/run/secrets/envs.sh,uid=1000,gid=1000 \ @@ -346,8 +348,6 @@ RUN --mount=type=secret,id=tsuru-app-envvars,target=/var/run/secrets/envs.sh,uid && { sh -lc 'mkdir -p /tmp/foo'; } \ && { sh -lc 'echo "Hello world" > /tmp/foo/bar'; } \ && : - -WORKDIR /home/application/current `, }, }