Skip to content

Conversation

@PeterDaveHello
Copy link
Contributor

Here are two changes:

  1. Remove --no-cache for apk in Dockerfile
  2. Clean up apk cache in Dockerfile after packages installed

These will make the build faster and the built image smaller.

The details are in the commit message.

As there is `apk upgrade` and `apk update`, the apk index will already
be existed. `--no-cache` is for `apk` when there is no `apk update`
behavior and it's expected to be no local cache left, not suitable for
the use case here, which wants to upgrade all the package to the latest
when packaging the image.
@drwetter
Copy link
Collaborator

drwetter commented Dec 9, 2020

Why do you prefer removing the apt-cache instead of not building it?

@PeterDaveHello
Copy link
Contributor Author

I'm not sure I understand the question.

The apk update will prepare the index, for apk upgrade and apk add, after those operations, it can and should be removed to minimize the image size, even if anyone uses this image will need more apk operations, which seems unlikely for most cases, the index cache could be expired/invalid and needed to be refreshed, there is no need to keep the cache in it.

@drwetter drwetter merged commit 4f375de into testssl:3.1dev Dec 9, 2020
@drwetter
Copy link
Collaborator

drwetter commented Dec 9, 2020

sorry, I just looked at the changed lines.

Thanks!

@PeterDaveHello PeterDaveHello deleted the RefactorDockerfileApkUsage branch December 9, 2020 08:18
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