GFDRR / rdl-data

Challenge Fund Database combining Hazard, Exposure, Loss and Vulnerability schema into a single database
GNU Affero General Public License v3.0
1 stars 2 forks source link

Improve docker build pattern #25

Closed jeanpommier closed 3 years ago

jeanpommier commented 3 years ago

Hi, It took me some time to understand how the docker image is built : the Dockerfile uses a dump.sql file, that is produced beforehand by the Makefile start command. This doesn't seem very portable for me. The current workflow works in this configuration, but would not be straightforward for, for instance, building and pushing a docker image, without running it first on the local computer.

I don't see any strong reason to proceed this way. I may have missed something, but I believe you could skip the aggregation step and just copy all the sql/*.sql files into /docker-entrypoint-initdb.d/ and then let postgres image load the scripts, as documented on https://hub.docker.com/_/postgres It would just mean renaming the files (the digits prefix) so that create-users.sql runs first.

Then the Makefile would be very trivial, maybe unnecessary even (limited to docker-compose up / down)

matamadio commented 3 years ago

Thanks Jean, with the migration of RDL to new AWS server we are looking to optimise the overall infrastructure of the platform. This includes simplify the whole docking creation, possibly getting rid of terraform if it is not strictly necessary to our needs. What you think?

matamadio commented 3 years ago

Related to old (superceeded) infra: closing.