Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make create-env: Use minikube image load #854

Merged
merged 1 commit into from
Oct 10, 2022

Conversation

mbana
Copy link
Contributor

@mbana mbana commented Oct 10, 2022

Instead of building the image in the minikube docker environment, build it on the host. I.e., remove eval $$(minikube docker-env --profile kgw); docker build in favour of:

$ docker build ...
$ minikube image --profile kgw load kubeshop/kusk-gateway:$(git describe --tags $(git rev-list --tags --max-count=1))

This should result in faster builds if you delete the minikube cluster and re-create as the kubeshop/kusk-gateway:$(git describe --tags $(git rev-list --tags --max-count=1)) images are not being built in the minikube docker daemon so its layers are cached.

Results

I benchmarked the changes:

Old:

$ hyperfine --runs 3 'minikube delete --profile kgw && time make create-env'
Benchmark 1: minikube delete --profile kgw && time make create-env
  Time (mean ± σ):     97.866 s ±  2.965 s    [User: 32.466 s, System: 7.927 s]
  Range (min … max):   94.516 s … 100.156 s    3 runs

New:

$ hyperfine --runs 3 'minikube delete --profile kgw && time make create-env'
Benchmark 1: minikube delete --profile kgw && time make create-env
  Time (mean ± σ):     65.146 s ±  0.983 s    [User: 30.162 s, System: 6.345 s]
  Range (min … max):   64.340 s … 66.241 s    3 runs

Signed-off-by: Mohamed Bana mohamed@bana.io


Could you please try out this branch to ensure it works in whatever setup you use.

Instead of building the image in the `minikube` docker environment, build it on the host.
I.e., remove  `eval $$(minikube docker-env --profile kgw); docker build` in favour of:

```sh
$ docker build ...
$ minikube image --profile kgw load kubeshop/kusk-gateway:$(git describe --tags $(git rev-list --tags --max-count=1))
```

This should result in faster builds if you delete the `minikube` cluster and re-create as the
`kubeshop/kusk-gateway:$(git describe --tags $(git rev-list --tags --max-count=1))` images are
not being built in the `minikube` docker daemon so its layers are cached.

Results
-------

I benchmarked the changes:

**Old**:

```sh
$ hyperfine --runs 3 'minikube delete --profile kgw && time make create-env'
Benchmark 1: minikube delete --profile kgw && time make create-env
  Time (mean ± σ):     97.866 s ±  2.965 s    [User: 32.466 s, System: 7.927 s]
  Range (min … max):   94.516 s … 100.156 s    3 runs
```

**New**:

```sh
$ hyperfine --runs 3 'minikube delete --profile kgw && time make create-env'
Benchmark 1: minikube delete --profile kgw && time make create-env
  Time (mean ± σ):     65.146 s ±  0.983 s    [User: 30.162 s, System: 6.345 s]
  Range (min … max):   64.340 s … 66.241 s    3 runs
```

Signed-off-by: Mohamed Bana <mohamed@bana.io>
@netlify
Copy link

netlify bot commented Oct 10, 2022

Deploy Preview for kusk-docs-preview canceled.

Name Link
🔨 Latest commit a35755e
🔍 Latest deploy log https://app.netlify.com/sites/kusk-docs-preview/deploys/6343fbb19d05f500088ba68b

@mbana mbana merged commit 7e24cfa into main Oct 10, 2022
@mbana mbana deleted the mbana-minikube-docker-build-speedup branch October 10, 2022 13:27
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.

3 participants