Reduce Docker container image size

Description

During the built of our container images, we copy the RPM files into the container image and install them locally. This has the side effect the RPM files are added as a layer with the copy command and can't be removed. This bloats the container image additional with 645 MB (compressed) with the size of the RPMs in the /tmp folder.

A solution to solve this problem is installing the RPMs not from the local filesystem and install them instead from an URL.

The problematic part is this line here:

When installing from a remote URL the RPMs are not added as a layer in the image.

Acceptance / Success Criteria

None

Attachments

1

Lucidchart Diagrams

Activity

Show:

Benjamin Reed June 10, 2020 at 9:09 PM

Fixed in foundation-2016 and up.

Benjamin Reed June 8, 2020 at 6:31 PM

This is fixed by the work to use lighttpd to serve up the RPMs in the docker builds. PR here: https://github.com/OpenNMS/opennms/pull/3018

Benjamin Reed September 20, 2019 at 2:33 PM

I suppose there's nothing saying we have to have all that stuff in the filename.  They're generated to be unique and incremental, so upgrades happen, but it's only the metadata that's important.  We could rename them before publishing them anywhere...

Ronny Trommer September 20, 2019 at 7:05 AM

One issue I've figured out, it is easy to build the first part of the URL: https://10746-9377198-gh.circle-artifacts.com/0/rpms/. It is more tricky to build file names like opennms-core-25.0.0-0.20190913.1.noarch.rpm and we don't have wildcards to fetch RPMS. This part from the file is not available which is created in the scripts in the DEB/RPM build step 25.0.0-0.20190913.1. I would like to avoid adding unnecessary code to rebuild these numbers.

Maybe can help us here. Is this really needed? As a naive idea, why not just create the file opennms-core.noarch.rpm? The artifacts live in a specific build and are not published to mirrors or such, but I don't probably overlook the whole picture here.

Ronny Trommer September 16, 2019 at 11:52 AM

Additionally, the artifacts are available as CircleCI artifact URLs anyway so we could probably use them as well: https://10746-9377198-gh.circle-artifacts.com/0/rpms/opennms-core-25.0.0-0.20190913.1.noarch.rpm

Fixed

Details

Assignee

Reporter

Components

Sprint

Affects versions

Priority

PagerDuty

Created September 16, 2019 at 10:34 AM
Updated June 10, 2020 at 9:09 PM
Resolved June 10, 2020 at 9:09 PM