I spent a day getting out of memory error building Next app from Dockerfile. It is a small app with a few pages. However, removing Dockerfile and let the app built with Buildpack results in successful deployment
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I have contacted the support team and one thing I know from them is that the App platform only has 8GB of RAM/Disk space combined available during build. So, it is not just RAM but I have to be careful about disk space also.
Spent a few days trying to tweak the Dockerfile. As Docker takes snapshot for each build step, I though I should make each layer as small as I could. So, I did install and build in one go and below is the Dockerfile I successfully deployed to the App platform
Hope this helps everyone who is facing the same problem
Hi @chatpong,
Please find the answers to your queries inline.
What is the memory limit when build with Dockerfile and how to increase it? –> In app platform there is 8GB of RAM available during build. Currently we do not support the increase of resources during build phase for any of our users. However, that is under discussion and might get updated in the future.
Is there an example Dockerfile for Next app? –> Here’s a sample git repo for deploying a Next app using a Dockerfile. I have tested it out on App Platform. https://github.com/tahafatimaDO/next-Dockerfile
Does the container size and plan (Basic/Pro) matter? –> The container size and plan doesn’t matter during the build phase. It only comes into play during the deploy and run time.
Cheers, Taha Fatima