#Payload v3 Postgres DB migrations using Dockerfile

4 messages · Page 1 of 1 (latest)

robust elm
#

I am currently on beta-68 but this issue I have been facing since the upgrade to v3. Previously in v2 there was payload-config available after the docker build and as suggested in one of the posts I was able to run the migration using npx payload migrate && npm serve as the last command in docker file.

Since, v3 the payload-config isn't available in the final build and thus I have to apply the migrations manually to our envs. The build generates the .next with server.js but no payload-config and the migrations dir to apply the migrations. Because the migrate cmd tries to locate the config file than the migrations dir to apply it.

The workaround I am thinking of: (is there a better way to achieve the same) Copy the required files in the inital stage of the build -> apply the migrations -> once done delete the dir and continue with the build process.

I have attached my dockerfile for ref.
What am I missing here? I want to be able to apply the migrations in my CI itself without having to clone the PG migration from payload Github.
Thanks.

deft flintBOT
robust elm
#

@spare tundra Thanks a lot for this, I'll have a look at it!