Suppot adding --context-sub-path
option to kaniko executor can handle more directory structure #7302
Closed
Description
This is a proposal.
To be able to specify --context-sub-path
option used by kaniko executor in the skaffold.yaml
can handle more directory structure.
Expected behavior
I can specify contextsubpath
option in skaffold.yaml
.
apiVersion: skaffold/v2beta28
kind: Config
metadata:
name: my-api
build:
artifacts:
- image: my-registory/my-api
context: rootdir/
kaniko:
dockerfile: ../environments/my-api/app/docker/Dockerfile
contextsubpath: my-api/
Actual behavior
I have a repository that has a structure like
environments/my-api/app/
├── docker
│ └── Dockerfile
└── skaffold.yaml
my-api/
└── src/ (source code for my-api)
I made skaffold.yaml
like following and run skaffold build
in environments/my-api/app/
.
apiVersion: skaffold/v2beta28
kind: Config
metadata:
name: my-api
build:
artifacts:
- image: my-registory/my-api
context: ../../../my-api
kaniko:
dockerfile: ../environments/my-api/app/docker/Dockerfile
...
But this fails with a kaniko executor error because skaffold only copies directories under context
whereas dockerfile
contains ../
.
Error: error resolving dockerfile path: please provide a valid path to a Dockerfile within the build context with --dockerfile
...
Ideally I would like to run a kaniko executor with --context-sub-path
option through skaffold.yaml
like
apiVersion: skaffold/v2beta28
kind: Config
metadata:
name: my-api
build:
artifacts:
- image: my-registory/my-api
context: ../../../
kaniko:
dockerfile: ../environments/my-api/app/docker/Dockerfile
contextsubpath: my-api/
...
What do you think about this proposal. Thank you for your attention in advance.