Learn how to seed your databases.
Dockerfile
using the mongo
image as the base image, and copy the necessary seed files to the /docker-entrypoint-initdb.d
path within that image. Any files within that path will be automatically executed by the image when the mongo
service starts.
Assume you have the seed script below, named seed.js
within a scripts
folder, for example.
Dockerfile
so that the JavaScript file is copied to /docker-entrypoint-initdb.d
when building the image.
Dockerfile
in the docker-compose.yml
file used by Ergomake.
postgres
image, you can simply copy your seed scripts to /docker-entrypoint-initb.d
. That’s because the image is configured to execute any files within that directory when the postgres
service starts.
Assume you had the seed script below, named dump.sql
, within a scripts
folder.
seed.sh
, within that same scripts
folder.
Dockerfile
to copy seed.sh
the dump.sql
to docker-entrypoint-initdb.d
, as shown below.
Dockerfile
in the docker-compose.yml
you use for Ergomake.
command
can run multiple times without errors so that your preview environments stay up.