GoogleContainerTools / kaniko

Build Container Images In Kubernetes
Apache License 2.0
14.89k stars 1.44k forks source link

Feature request: support --parents flag for COPY #3165

Open colindean opened 6 months ago

colindean commented 6 months ago

Using Kaniko version v1.22.0, when I attempt to build this Dockerfile

# syntax=docker/dockerfile:1.7-labs
FROM scratch

# the [t] here conditionally copies version.txt in if it exists
COPY --parents alpine/ conda/ debian/ python/ security.txt version.tx[t] /

it fails:

error building image: parsing dockerfile: dockerfile parse error on line 5: unknown flag: parents

I reckon Kaniko doesn't yet support the 1.7-labs Dockerfile specification.

Workaround seems to be a more verbose but just as valid end result:

FROM scratch

COPY alpine/ /alpine/
COPY conda/ /conda/
COPY debian/ /debian/
COPY python/ /python/
# the [t] here conditionally copies version.txt in if it exists
COPY security.txt version.tx[t] /

Related issues