Open tewshi opened 1 month ago
That is correct!
https://github.com/rodydavis/pocketbase-cloudrun/blob/main/Dockerfile#L27
You need to upload the files for pb_public and pb_hooks directly to cloud storage in the same location beside pb_data. It is already mapped but pb_data is created the first time it is run
wish there's a way to handle this, wanted to. use gcloud storage cp
but that will require authentication in the docker image...
also tried docker --mount
option, mount only works when running the image, not when building.
there has to be an easier way to get it done...
Well as per the command you can customize the paths.
If you want them to be local to the container, just modify the Dockerfile to change where they point to.
Then you would just copy the files in on docker build.
after doing some findings, I was able to automate it.
moved the copy command to use the cloud build config, while cloud run is running, copy the files to storage
cloudbuild.yaml
steps:
- name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', '-r', 'migrations/', 'gs://${_CLOUD_BUCKET}/']
then the docker build step followed, I've also been able to use this flow to generate and copy frontend files
@rodydavis
Woah that is awesome!!
Could you make a PR with the changes?
Okay, I'll do it, give me some time.
Not a problem! Really appreciate it 🚀
After applying the changes as suggested, I deployed successfully, but noticed that the pb_hooks, pb_public and pb_migrations directories are not saved on cloud storage.
The pb_data directory copies, which I believe it does so because it is generated at run time and not at build time.
when I run the docker build locally, I can see the
/cloud/storage
folder in the files of the image (which is expected since I'm not mounting any cloud directory in my local machine), but I expect this/cloud/storage
to be mapped (at docker build time) to the actual mounted directory pointing to Google cloud storage