Commit 734e1dfa authored by Marcel Amirault's avatar Marcel Amirault

Merge branch 'docs-docker-multi-stage-build' into 'master'

Docs: Recommend multi-stage builds for efficient Docker image builds

See merge request gitlab-org/gitlab!46032
parents 88d0b9c8 9c9c67f5
...@@ -222,6 +222,8 @@ Methods to reduce Docker image size: ...@@ -222,6 +222,8 @@ Methods to reduce Docker image size:
- Create a dedicated development image. - Create a dedicated development image.
- Disable man pages and docs installed by packages to save space. - Disable man pages and docs installed by packages to save space.
- Reduce the `RUN` layers and combine software installation steps. - Reduce the `RUN` layers and combine software installation steps.
- Use [multi-stage builds](https://blog.alexellis.io/mutli-stage-docker-builds/)
to merge multiple Dockerfiles that use the builder pattern into one Dockerfile, which can reduce image size.
- If using `apt`, add `--no-install-recommends` to avoid unnecessary packages. - If using `apt`, add `--no-install-recommends` to avoid unnecessary packages.
- Clean up caches and files that are no longer needed at the end. For example - Clean up caches and files that are no longer needed at the end. For example
`rm -rf /var/lib/apt/lists/*` for Debian and Ubuntu, or `yum clean all` for RHEL and CentOS. `rm -rf /var/lib/apt/lists/*` for Debian and Ubuntu, or `yum clean all` for RHEL and CentOS.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment