strapi-docker icon indicating copy to clipboard operation
strapi-docker copied to clipboard

Bundle node_modules inside Docker images

Open gempain opened this issue 3 years ago • 3 comments

Feature request

Please describe your feature request

  • [x] I have created my request on the Product Board before I submitted this issue
  • [x] I have looked at all the other requests on the Product Board before I submitted this issue

Summary

Currently, starting a Strapi docker container for the first time takes several minutes due to the Npm install, and this dependency can lead to failed runs.

Why is it needed?

This dependency on the Npm registry has a few drawbacks:

  • large startup time on first run
  • breaking startup if an Npm package has been unpublished (unlikely to happen)
  • breaking startup if the Npm registry is down

Suggested solution(s)

Package node_modules with the Docker images published to DockerHub.

Related issue(s)/PR(s)

gempain avatar Feb 16 '21 20:02 gempain

Building modues etc. on startup means also, that you need build tools in your container. So you end up with a production container, which hast gcc installed. See: https://github.com/strapi/strapi-docker/blob/master/base/alpine/Dockerfile#L4 From a security perspective this is a big no go.

monotek avatar May 10 '21 13:05 monotek

Not sure whether your argument is in favor or against the issue.

gempain avatar May 19 '21 09:05 gempain

In favour :)

The way it's done now is against container best practices.

monotek avatar May 19 '21 22:05 monotek