Open jtoar opened 1 year ago
@jtoar I think we can use Docker Multi-stage builds to solve this (for now): https://docs.docker.com/build/building/multi-stage/
With multi-stage builds, you use multiple FROM statements in your Dockerfile. Each FROM instruction can use a different base, and each of them begins a new stage of the build. You can selectively copy artifacts from one stage to another, leaving behind everything you don’t want in the final image.
For the Web Dockerfile, we can start with both API and Web, run through the steps, then remove API.
Note: We need to make API Build, Prisma Migrate, and Data-migrate have completed successfully before Building Web and running prerender.
TBD
Thanks for looking into this issue, any update on this issue? Also does the Coherence deployment(https://docs.redwoodjs.com/docs/deploy/coherence/) support both serverless and serverful deployment?
I see that Coherence has removed their write-up about Redwood-JS setup from their docs https://docs.withcoherence.com/configuration/frameworks/#redwood-js , does it mean it's not supported any more? In general, can you comment on the state of the Coherence deployment support for RWJS?
What's not working?
When deploying to Coherence, the web's build string has to be:
build: ["yarn", "rw", "build", "web", "--no-prerender"]
. We can't prerender because theDATABASE_URL
env var isn't supplied to the web's build container. When the web side prerenders, it doesn't actually make a call to the api server over the network. Instead it imports the GraphQL handler directly from the api side and runs it programmatically. This means it needs access to the database for the underlying prisma calls. This also means the build container for the web side can't just contain web-side code—it needs the whole project more or less.How do we reproduce the bug?
Setup up coherence deploy:
--no-prerender
line from thebuild
command incoherence.yml
and replace it with this (this handles initial deploy where the database hasn't been provisioned yet):What's your environment? (If it applies)
Are you interested in working on this?