Custom invocation image does not work if removing # PORTER_INIT
Closed this issue · 0 comments
edespong commented
Describe the bug
https://getporter.org/docs/bundle/custom-dockerfile/#porter_init indicates that # PORTER_INIT
could be removed:
When that line is omitted, the lines are inserted after the FROM statement at the top of your template.
In the porter create
template, it is placed after the FROM, so it should not make a difference if the line is there or not.
To Reproduce
Run the following:
mkdir custom-invocation-bundle
cd custom-invocation-bundle
porter create
echo "Removing # PORTER_INIT"
sed -i 's/# PORTER_INIT//g' template.Dockerfile
echo "Adjusting to use template.Dockerfile explicitly"
sed -i 's/#dockerfile: template.Dockerfile/dockerfile: template.Dockerfile/g' porter.yaml
porter build
Expected behavior
The build should succeed.
Porter Command and Output
$ porter build
Copying porter runtime ===>
Copying mixins ===>
Copying mixin exec ===>
Building invocation image
[+] Building 2.8s (12/16)
=> [internal] load .dockerignore 0.0s
=> => transferring context: 227B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.66kB 0.0s
=> resolve image config for docker.io/docker/dockerfile-upstream:1.4.0 0.4s
=> CACHED docker-image://docker.io/docker/dockerfile-upstream:1.4.0@sha256:178c4e4a93795b9365dbf6cf10da8fcf517fcb4a17f1943a775c0f548e9fc2ff 0.0s
=> [internal] load metadata for docker.io/library/debian:stable-slim 0.5s
=> [stage-0 1/10] FROM docker.io/library/debian:stable-slim@sha256:149e944a6f4855f9738baf4ddd79fc2f218e6440218223fa9017aebc1e45f1f5 0.0s
=> [internal] load build context 1.0s
=> => transferring context: 100.81MB 0.9s
=> CACHED [stage-0 2/10] RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache 0.0s
=> CACHED [stage-0 3/10] RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt apt-get update && apt-get install -y ca-certificates 0.0s
=> CACHED [stage-0 4/10] COPY --link . 0.0s
=> CACHED [stage-0 5/10] RUN useradd nonroot -m -u 65532 -g 0 -o 0.0s
=> ERROR [stage-0 6/10] RUN rm /cnab/app/porter.yaml 0.4s
------
> [stage-0 6/10] RUN rm /cnab/app/porter.yaml:
#0 0.328 rm: cannot remove '/cnab/app/porter.yaml': No such file or directory
------
error building docker image: failed to solve: process "/bin/sh -c rm ${BUNDLE_DIR}/porter.yaml" did not complete successfully: exit code: 1
unable to build CNAB invocation image: error building docker image: failed to solve: process "/bin/sh -c rm ${BUNDLE_DIR}/porter.yaml" did not complete successfully: exit code: 1
unable to build CNAB invocation image: error building docker image: failed to solve: process "/bin/sh -c rm ${BUNDLE_DIR}/porter.yaml" did not complete successfully: exit code: 1
Version
porter v1.0.14 (0e739d8)