Also, note that "translating an image to an app" is what new-app does.
You can run "oc new-app GIT_REPO -o yaml --dry-run" to see what new-app generates, and pipe that directly into the export command:
oc new-app ... | oc export -f - --as-template=foo > template.yaml
Which generates the final template to a file on disk.
You don't need to "translate" the Dockerfile to a template. Instead, you can create a Docker build that will build an image out of the Dockerfile and can be deployed in OpenShift.
You can also create a template that will automated the creation of a BuildConfig, a DeploymentConfig, a Service, etc, see this example:
In the example, the BuildConfig.spec.source refers to a git repository that contains a Dockerfile. You can also use an inline Dockerfile as a source of your BuildConfig:
OpenShift Developer Experience