rakesh kotian
rakesh kotian

Reputation: 252

How to migrate docker file to okd/openshift template?

I have the following working dockerfile,

#using python3.6 image
FROM python:3.6
ENV PYTHONUNBUFFERED 1

#Installing required packages 
RUN apt-get update
RUN apt-get install libsasl2-dev libldap2-dev libssl-dev python3-dev psmisc -y

#Installing a pip package which has django project in-built
RUN pip install <pip-package>

#Running a script-> appmanage.py, which installs a app to django project
RUN appmanage.py appconfig 

#Running the django development server.
CMD ["manage.py","runserver","0.0.0.0:8000"]

How can i design a okd/openshift template yaml/json for this? I prefer a template in which the docker image-build will be handled in the template itself, instead of building a image with docker build and using the image name with tag in template.

Upvotes: 0

Views: 657

Answers (1)

Oligzeev
Oligzeev

Reputation: 511

To export BuldConfig as template:

  1. Create BuildConfig with Dockerfile from a repo:

    oc new-build --name python-app --strategy=docker https://somegitrepo/python-app
    
  2. Or with inline Dockerfile:

    cat Dockerfile | oc new-build --name python-app --dockerfile=-
    
  3. Export the BuildConfig as template:

    oc export bc python-app --as-template=python-app-template
    

Then you can create DeploymentConfig from the created imagestream and export dc/is too.

Upvotes: 2

Related Questions