Skip to content

Optimized docker image#2

Open
felixivance wants to merge 2 commits intokadimasum:mainfrom
felixivance:optimized-docker-image
Open

Optimized docker image#2
felixivance wants to merge 2 commits intokadimasum:mainfrom
felixivance:optimized-docker-image

Conversation

@felixivance
Copy link

Reduced size of docker image by

  1. multistage builds - This involves using multiple FROM instructions in my Dockerfile, where each FROM instruction starts a new stage with a new base image. This allows me to use different base images for different stages of your build process and copy only the necessary files from each stage.

  2. use of Alpine base image: Used a smaller base image, such as Alpine Linux, for my Docker image. Alpine Linux is known for its small size and can significantly reduce the size of my image compared to using a larger base image like Ubuntu.

  3. Reduce layers: Tried to reduce the number of layers in my image by combining multiple RUN instructions into a single RUN instruction. This is done by chaining commands together using && in a single RUN instruction.

  4. Cleanup: Remove any unnecessary files or dependencies after they are no longer needed. For example, I removed the node_modules directory after running npm install to reduce the size of the final image.

@kadimasum
Copy link
Owner

Good work. As your next assignment, I would like you to harden the image.

@felixivance
Copy link
Author

Cool thanks, let me research on it

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.

2 participants