Currently I'm trying for local development to upload source and build files to Openshift, so they can be build and run in a Docker container. However the project folder may already contains artifacts and dependencies, which slows down the upload process dramatically.
It would be nice if there is some functionality to exclude certain folders, like with a .dockerignore or with the use of filepatterns. Or is this already possible?
Thanks in advanced!
it's not possible, but you can do a tar operation that only tars the file you want and then pass that tar file to --from-archive.
https://docs.openshift.org/latest/dev_guide/builds/build_inputs.html#binary-source
is there an issue to track the lack of .dockerignore support? or should we create one?
it's not a lack of .dockerignore support, it's that .dockerignore support doesn't make sense as a concept for what is fundamentally an openshift build concept.
If you want to control what files are being provided to an openshift build when you do a binary build, the way to do that currently would be to create a tar that contains the inputs you want to use and then provide that tar file via the binary build process. That's independent of whether your openshift build that consumes those files is ultimately a docker build, an s2i build, or some other build strategy.
If we introduced anything, it would be either:
1) flags on oc start-build that work in conjunction with --from-dir to allow you to exclude specific file patterns
2) support for a ".openshiftignore" file which contained patterns to be ignored.
I can appreciate the value of something like .openshiftignore as a universal / top-level directive.
however, when talking about the docker build strategy for example, the user assumption here is that the build will execute in compliance with docker build behaviour _(as per the documentation)_, using Dockerfile and discarding .dockerignore breaks that expectation.
however, when talking about the docker build strategy for example, the user assumption here is that the build will execute in compliance with docker build behaviour (as per the documentation), using Dockerfile and discarding .dockerignore breaks that expectation.
it doesn't ignore it. all your files are uploaded to the dir that is used for the docker build operation. including your .dockerignore file. the docker build that is then invoked on that directory will respect your .dockerignore file. you are confusing the two steps of the build:
1) prepare all input files to make them available to the docker build (or s2i build) in a working directory. .dockerignore is irrelevant here.
2) invoking the docker build on the working directory. .dockerignore is relevant and respected here.
an .openshiftignore would be cool.. where is the Go source code that deals with oc start-build --from-dir ?
the flag is read here, you can trace the usage from that point on:
https://github.com/openshift/origin/blob/master/pkg/oc/cli/cmd/startbuild.go#L115
So is this officially closed with resolution wontfix?
the flag is read here, you can trace the usage from that point on:
https://github.com/openshift/origin/blob/master/pkg/oc/cli/cmd/startbuild.go#L115
The link is dead.
we eventually determined that there is indeed a bug in the docker strategy handling of .dockerignore which is recorded here:
https://bugzilla.redhat.com/show_bug.cgi?id=1487356
but we have no plans to introduce an oc client level ignore from the --from-dir argument at the moment.
Most helpful comment
an
.openshiftignorewould be cool.. where is the Go source code that deals withoc start-build --from-dir?