Importing SQL dump in devspace deployment using Helm component charts

249 views Asked by At

When I was using skaffold I just had a Dockerfile that was used to do the following:

FROM postgres:13-alpine
EXPOSE 5432
COPY *.sql /docker-entrypoint-initdb.d/

This would copy a dev SQL dump to load into a local dev database as it was spinning up.

Now that I'm using devspace and using Helm Component Charts, I've been able to get rid of dev manifests and looking to get rid of this Postgres Dockerfile since it isn't doing much except importing this file in.

Looking at the Component Chart documentation, I'm not seeing how to add a parameter to copy the local SQL dump into the container in deployment phase.

Any suggestions, or should I be using Hooks and targeting a specific lifecycle event?

1

There are 1 answers

0
Lukas Gentele On BEST ANSWER

Yes, you should be using the after:initialSync:* hook, i.e. if your sql dump file is part of the file sync, it will be uploaded during initialSync, then the hook can be used to import the dump.