Skip to content

Add docker-slim support - #59

Open
Rasek91 wants to merge 12 commits into
efficientgo:mainfrom
Rasek91:docker-slim
Open

Add docker-slim support#59
Rasek91 wants to merge 12 commits into
efficientgo:mainfrom
Rasek91:docker-slim

Conversation

@Rasek91

Copy link
Copy Markdown
Contributor

Add type dockerSlimRunnable to be able to run conatiners and build slim images with docker-slim. Some of the differences compared to dockerRunnable:

  • The slim image name will the original image with a suffix "-slim".
  • The container name always dynamically generated and can not be changed.
  • There is option to specify extra arguments to the docker-slim build command.
  • For stopping the conatiner the Stop and Kill functions send USR1 signal to docker-slim.

I tested the code with docker-slim and the it runs well and build the slim image after tests are finished but the container logs only available after the docker-slim stopped it.

@bwplotkabwplotka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is great. I only wonder if it's time to rethink how we can add multiple providers in efficient way going forward.

For example I would argue slim version could be another "*Environment". The API was designed to accommodate such thing in future e.g. KindEnvironment or UnixProcessEnvironment and so on. This also mean it's maybe time for another packages that could extend this logic.

NOTE: We can break API on the way, given this is v0.14.0 version - actually that's why version we have v0.x version. Wanna brainstorm with me how it could look like?

Alternative is to perhaps have single option to Runnable "IsSlim" 🙃 but something future proof would be nice... WDYT?

And sorry for slow response, this is super quality code, I love it, thanks! - I am available to chat on Slack,Twitter,Linkedin etc (https://www.bwplotka.dev/)

@Rasek91

Copy link
Copy Markdown
ContributorAuthor

Hi @bwplotka, I really like to discusse how we can do it future proof, I ping you on Slack.

douglascamataand others added 10 commits May 13, 2023 17:50
* Detect WSL2 and open in browser from Windows
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Fix hostAddr in WSL2
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Fix host-local endpoint test in WSL2
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Fail fast to start in WSL2 with cadvisor
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Inline some conditionals
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Detect WSL 2 without relying on OS binaries/tools
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Fix var name
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Drop environment.WSL2() and use func from package
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Improve how OS platform is checked
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Document what is WSL
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Fix WSL2 check for network test
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Fix networkType deletion
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Separate OS platform function into its own package
* Reorder imports
* Add TODO to new `host` package
* Please the copyright linter
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Use minio console access as readiness check
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Update etcd example lines
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Please the copyright linter
* Test minio readiness by making a bucket
* Rebuild
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Adding comment linking to issue about minio readiness check
* Go fmt file
* Update example go.sum file
* Update mdox entry
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Improve minio readiness check
It uses now the cluster health endpoint, so we don't need the console
anymore.
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Make xargs macOS friendly
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Remove now unused console port name variable
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Update README
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
* Add option to enable TLS for minio
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
* Fix readiness probe
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
* Fix lint
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
* env_docker: support docker-in-docker
If we are running e2e tests inside Docker then it's not so
straightforward to access host's network. Let's use the special
`host.docker.internal` for that.
* env_docker: try resolve before using docker gateway
* CI: ensure macOS can connect to containers in Lima
This commit allows the macOS host in CI to route packets directly to the
IP addresses of containers running inside the Lima guest VM, without
needing to explicitly forward ports via SSH. This allows macs to behave
the same way that Linux hosts do.
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
* e2e: add environment for kind
This commit adds a new implementation of the Environment interface
implemented using kind, ie Kubernetes in Docker. The motivation is that
you might want to manually run some complex configurations in the e2e
tests using Kubernetes resources and still manage the tests simply using
the e2e package.
Users who need the escape hatch of deploying things to a Kubernetes
cluster manually, e.g. workloads that are not a simple deployment, can
use the kubeconfig file located in the environment's shared directory.
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
---------
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: bwplotka <bwplotka@gmail.com>
@bwplotka

Copy link
Copy Markdown
Contributor

Can't see any ping, let's retry?

Sign up for freeto 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.

6 participants

@Rasek91@bwplotka@douglascamata@saswatamcode@GiedriusS@squat