kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

Using --context cause flatten folders

Open ipa-rwu opened this issue 2 years ago • 0 comments

Actual behavior Using --context causing flatten all the folders

To Reproduce Steps to reproduce the behavior:

I am working on a gitlab repository. The folder structure looks like the following:

% tree
.
├── Dockerfile
├── README.md
├── folder_1
│   └── folder_1_1
│      └── folder_1_1_1
├── folder_2
│   └── folder_2_1
│      └── folder_2_1_1
└── .gitlab-ci.yaml

I use a command as follows in gitlab-ci.yaml

- /kaniko/executor
      --context "${CI_PROJECT_DIR}"

My dockerfile looks like as follows:

COPY . /root/ws/src/pkg/

Then I found out kaniko flatten folders, so in my root folder, it looks like:

% tree
.
├── Dockerfile
├── README.md
├── folder_1
│   └── folder_1_1
│      └── folder_1_1_1
├── folder_2
│   └── folder_2_1
│      └── folder_2_1_1
└── folder_1_1
└── folder_1_1_1
└── folder_2_1
└── folder_2_1_1
└── .gitlab-ci.yaml

So when I use COPY . /root/ws/src/pkg/, it will copy replicated folder.

Expected behavior I expect it will keep the folder structure as the repository, and copy it into docker workspace

Triage Notes for the Maintainers

Description Yes/No
Please check if this a new feature you are proposing
  • - [ ]
Please check if the build works in docker but not in kaniko
  • - [ ]
Please check if this error is seen when you use --cache flag
  • - [ ]
Please check if your dockerfile is a multistage dockerfile
  • - [ ]

ipa-rwu avatar Sep 02 '22 13:09 ipa-rwu