Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[talk] - further docker image size reduction #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

miroslavpejic85
Copy link
Collaborator

Before

REPOSITORY        TAG               IMAGE ID       CREATED         SIZE
talk-talk         latest            9c99e6db1ba9   3 minutes ago   207MB

After

REPOSITORY        TAG               IMAGE ID       CREATED         SIZE
talk-talk         latest            3d15cd139337   6 seconds ago   200MB
  1. npm cache clean --force: This command clears the npm package cache. The npm package cache can accumulate over time as you install various packages. Cleaning the cache helps to remove unnecessary files, which can save space in the final image.

  2. rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* /usr/share/doc/*: This command removes various temporary and cache files from the system. Let's break down each part:

    • /tmp/*: Deletes files from the system's temporary directory. Temporary files can take up space, and removing them is a common practice to keep the image size smaller.
    • /var/lib/apt/lists/*: Deletes package lists retrieved during the package installation process. These lists can take up space and are not necessary in the final image.
    • /var/tmp/*: Removes temporary files from another temporary directory.
    • /usr/share/doc/*: Deletes documentation files for installed packages. While documentation is useful, it's often not required in the final image, especially for production use cases.

By including these commands in your Dockerfile, you're effectively cleaning up various temporary and unnecessary files, which helps in reducing the size of the final Docker image. This can be particularly important in production environments where smaller image sizes contribute to faster deployment times and reduced resource consumption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant