[
https://issues.apache.org/jira/browse/METRON-1650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16530808#comment-16530808
]
ASF GitHub Bot commented on METRON-1650:
----------------------------------------
GitHub user jameslamb opened a pull request:
https://github.com/apache/metron/pull/1091
METRON-1650: Cut size of packaging docker containers
## Contributor Comments
I have been looking through the project source code, and found that the
packaging docker containers are bigger than they need to be.
The containers' size could be cut substantially by:
* Grouping as many commands as possible into as few RUN stages as possible
* Taking advantage of `yum clean` and `apt-get clean`
* Removing artifacts pulled with `wget`
* Removing unused libraries or libraries only needed at build time (like
`tar` and `wget`)
In local testing, I found the following reductions in container size:
`deb`: 700MB --> 672MB
`rpm`: 1GB --> 566MB
`ansible`: 2.48GB --> 1.21GB
To test these changes, run the following on current master from the repo
root:
```
METRON=$(pwd)
for pkgtype in ansible deb rpm; do
cd ${METRON}/metron-deployment/packaging/docker/${pkgtype}-docker/
docker build -t ${pkgtype}_orig -f Dockerfile .
done
```
Then run again on the PR branch:
```
METRON=$(pwd)
for pkgtype in ansible deb rpm; do
cd ${METRON}/metron-deployment/packaging/docker/${pkgtype}-docker/
docker build -t ${pkgtype}_pr -f Dockerfile .
done
```
You can then use `docker images` to compare the size of the original images
to those generated by the Dockerfiles in this PR.
Thanks for considering this change!
## Pull Request Checklist
### For all changes:
- [y] Is there a JIRA ticket associated with this PR? If not one needs to
be created at [Metron
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
- [y] Does your PR title start with METRON-XXXX where XXXX is the JIRA
number you are trying to resolve? Pay particular attention to the hyphen "-"
character.
- [y] Has your PR been rebased against the latest commit within the target
branch (typically master)?
### For code changes:
- [y] Have you included steps to reproduce the behavior or problem that is
being changed or addressed?
- [y] Have you included steps or a guide to how the change may be verified
and tested manually?
- [] Have you ensured that the full suite of tests and checks have been
executed in the root metron folder via:
```
mvn -q clean integration-test install &&
dev-utilities/build-utils/verify_licenses.sh
```
- [ ] Have you written or updated unit tests and or integration tests to
verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] Have you verified the basic functionality of the build by building
and running locally with Vagrant full-dev environment or the equivalent?
### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in
which it is rendered by building and verifying the site-book? If not then run
the following commands and the verify changes via
`site-book/target/site/index.html`:
```
cd site-book
mvn site
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jameslamb/metron master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/metron/pull/1091.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1091
----
commit 64ece102875f827293814f3c4ac3a091f8c86df8
Author: James Lamb <jaylamb20@...>
Date: 2018-07-03T04:17:20Z
METRON-1650: Cut size of packaging docker containers
----
> Packaging docker containers are too large
> -----------------------------------------
>
> Key: METRON-1650
> URL: https://issues.apache.org/jira/browse/METRON-1650
> Project: Metron
> Issue Type: Improvement
> Reporter: James Lamb
> Priority: Minor
>
> I have been looking through the project source code, and found that the
> packaging docker containers are bigger than they need to be.
> The containers' size could be cut substantially by:
> * Grouping as many commands as possible into as few RUN stages as possible
> * Taking advantage of `yum clean` and `apt-get clean`
> * Removing artifacts pulled with `wget`
> * Removing unused libraries or libraries only needed at build time (like
> `tar` and `wget`)
> I am creating this issue but will soon submit a PR to address it.
> Thank you for considering my proposal!
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)