graph-explorer icon indicating copy to clipboard operation
graph-explorer copied to clipboard

[Feature Request] Reduce Docker image size

Open kmcginnes opened this issue 9 months ago • 2 comments

Description

We should find ways to reduce the Docker image size if possible.

Additional Context

The Docker image size increased when we updated Node to v20.12.2.

The majority of the size is both Node itself and all the tools required to download and install Node.

There are base images that already include Node and are optimized for file size. I've tested node:20.12.2-alpine which seems to work and is very small and quick to build.

Example Docker Image Builds

Alpine Node Image - Node v20

  • Build time - 28 seconds
  • Image size - 542 MB

Amazon Linux 2022 Image - Node v20

  • Build time - 36 seconds
  • Image size - 542 MB

Amazon Linux 2023 Image - Node v20

  • Build time - 39 seconds
  • Image size - 812 MB

Amazon Linux 2022 Image - Node v16

  • Build time - 37 seconds
  • Image size - 729 MB

Related Issues

Relates to issue #307.

Tasks

  • [ ] Reduce dependency installs
  • [x] Try different base images

[!IMPORTANT] If you are interested in working on this issue or have submitted a pull request, please leave a comment.

[!TIP] Please use a 👍 reaction to provide a +1/vote.

This helps the community and maintainers prioritize this request.

kmcginnes avatar Apr 29 '24 21:04 kmcginnes

Could impact issue #132

kmcginnes avatar Apr 30 '24 14:04 kmcginnes

The YouTube video below mentioned a tool in Docker called "scout" that has a compare function that can compare the vulnerabilities between two Docker images.

We can use this to compare the AWS linux image to the Alpine image to see if there are any regressions in vulnerabilities.

We can also use the docker init command to see if we can use any of the Docker best practices in the template file in our own Dockerfile.

kmcginnes avatar May 06 '24 14:05 kmcginnes