BCDevOps / issues-and-solutions

Creative Commons Zero v1.0 Universal
10 stars 0 forks source link

Template for Docker strategy build using code sourced from git repo #2

Closed watkinspd closed 8 years ago

watkinspd commented 8 years ago

There should be a instant-app type template that specifies a Docker build strategy and uses the Dockerfile and other application files from a git repo.

Scenario:

f-w commented 8 years ago

Closest workaround for now is CLI oc new-app, but I can create such template.

f-w commented 8 years ago

I have created the template and tested successfully to deploy bca-api. To use it, until the template has been promoted to root namespace, copy the yaml file to your local folder and run

oc create -f dockerfile-over-git.yaml

for updating existing template, run

oc replace -f dockerfile-over-git.yaml

instead.

There are several imperfections/caveats due to limited programbility within a template:

  1. Not only you have to specify git URL of Dockerfile, you also have to redundantly specify base image and tag which is in the FROM clause of Dockerfile.
  2. OpenShift cannot convert a parameter from string to number or vice versa (see openshift/origin#3946) so not only I cannot obtain what port the docker is exposing the service by parsing the Dockerfile, but also I cannot even ask user to enter it as parameter. As a result, I have to hard code it to 8080. If this is incorrect for your Dockerfile, you have to change it in the runtime service instance after launch.