Friday, August 18, 2017

s2i scripts override in OpenShift

This  post is about how to override s2i scripts in application source repo. itself.

This way we can avoid to build the builder image again (which is where the build scripts usually present).

Add .s2i/bin/<all your build scripts> in github repo.

Example: https://github.com/SaravanaStorageNetwork/tests2i/

Then you can build like this:
s2i build https://github.com/SaravanaStorageNetwork/tests2i.git nginx-centos7 nginx-centos7-s2i-testing     

Where,
- nginx-centos7 is the builder image already built.
- nginx-centos7-s2i-testing  is the output image.
- https://github.com/SaravanaStorageNetwork/tests2i.git  - repo. having all source files and here it includes .s2i/bin build scripts too.


Note:
1.
if the source is in local directory, you need to specify build scripts using -s option as below:
s2i  build --pull-policy=never --loglevel=2 file:///root/template/s2i-using-s3/examples/nginx-centos7/test/test-app nginx-centos7 nginx-centos7-testapp     -s  file:///root/template/s2i-using-s3/examples/nginx-centos7/test/.s2i/bin/

2.
Ensure LABEL io.openshift.s2i.scripts-url= is removed from builder image Dockerfile.

No comments:

Post a Comment