Docker: How to setup production container to be smaller?
See original GitHub issueHello, i am using old version of react-starter kit intl with old tools(build,run etc) before update of webpack, my webpack is (1.13.3) i am new with this, is there any way to build all node_modules that needed in single file while doing
npm run build – --release and then just build docker container without
RUN npm install yarn --global --no-progress --silent --depth 0 && \
yarn install --production --no-progress
? My build folder is 5ΜΒ. But Docker Container become 500mb Sorry for the inconvenience
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How To Reduce Docker Image Size: 5 Optimization Methods
Method 3: Minimize the Number of Layers Docker images work in the following way – each RUN, COPY, FROM Dockerfile instructions add a...
Read more >3 simple tricks for smaller Docker images - Learnk8s
1. Squash multiple layers into one with multi-stage Docker builds · 2. Remove all the unnecessary cruft from the container with distroless ·...
Read more >How to make smaller Docker containers (including multi-stage ...
If not careful, containers can become much larger than necessary which makes them annoying to download/upload from/to a container registry.
Read more >How to Reduce Docker Image Size in Docker Containers
The following sections cover three methods to make your Docker image size smaller. Method 1: Applying Multi-Stage Builds. Having separate ...
Read more >BEST PRACTICES TO REDUCE DOCKER IMAGES SIZE
Best Practices to Reduce Docker Images Size · 1. USE A SMALLER BASE IMAGE · 2. DON'T INSTALL DEBUG TOOLS LIKE curl/vim/nano ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello,
I hope to bring a solution as is been too long time and this is open. I found this as I looking for best practices and improvements in my learning curve about Docker.
Intro to the solution
Docker has the ability to use the multi-stage build for the containerization process and we can also name them to be reutilized certain things from the other stages.
What is Multi-Stage Builds
An example:
I hope this all gives you the solution you where looking for, @Shadowman4205 and the others.
Read the full documentation for Multi-stage Builds
I found this from dockerfile best practices
@Shadowman4205 thank you very much for crating this issue! Unfortunately, we have close it due to inactivity. Feel free to re-open it or join our Discord channel for discussion.
NOTE: The
main
branch has been updated with React Starter Kit v2, using JAM-style architecture.