YannickB / odoo-hosting

Other
64 stars 50 forks source link

Script CMD in Dockerfile and command after creation #198

Open YannickB opened 7 years ago

YannickB commented 7 years ago

Hello all,

I am working on the docker compose for Clouder, using our images.

The main problem I am facing is the fact I have to replace the variable in config https://github.com/clouder-community/clouder/blob/master/clouder_template_odoo/images/odoo-data/odoo.conf#L14, which are currently done by Clouder https://github.com/clouder-community/clouder/blob/master/clouder_template_odoo/template.py#L61. Of course, for the docker-compose we don't have a Clouder to execute them.

Maybe there is a way to execute theses commands in the docker-compose, but I guess we should instead set them in environnement variable, and run a script on CMD which will replace the variable in config if they are not set, then run odoo-server.py

That said... I really dislike the idea of a script in CMD. I know everyone is using it, but I think it's poor design. If I do this in the odoo images we'll probably use them in all other Clouder images, do we have any other alternatives ? thoughts ?

lasley commented 7 years ago

Script in CMD is totally bad practice at least from what I've seen. Any scripts should be a part of the entrypoint, trigger upon conditions. The CMD should simply expose the service that is being offered in the container IMO. Otherwise you can't work in your container without triggering a bunch of crap.

Could we not just use environment variables and interpolate them with the existing environment when we copy the conf over? Although in that instance, we would want to use build args instead because the interpolation is on build and not run.

Take a look at @yajo's work in docker-odoo-base. He has variable interpolation happening there & is using env:

Files here will be environment-variable-expanded and concatenated in

YannickB commented 7 years ago

Yeah I agree we shall use ENTRYPOINT. Thanks for the example.

lasley commented 7 years ago

Curious - did this end up working? I'm about to need something similar I think

YannickB commented 7 years ago

Unfortunately I don't know yet :/, I set aside the compose for now to concentrate on the oneclick debug.