As answered on my blog, the idea of using opt/app and app is different.
You don’t want node modules inside the same folder as the app if we can help it.
The reason for it is that it gives more attack surface in a container, so it’s a security risk.
You can try to use the tool that I created for it.
As it creates the files and even a docker-compose for you.
- @strapi-community/dockerize - npm
- GitHub - strapi-community/strapi-tool-dockerize: Easy add support for docker to your strapi project