testcontainers-go icon indicating copy to clipboard operation
testcontainers-go copied to clipboard

Added support for building images with buildkit

Open silh opened this issue 1 year ago • 5 comments

What does this PR do?

Automatically build images with buildkit instead of the old builder.

Why is it important?

Buildkit is since a few docker version a default building mechanism in Docker and many Dockerfiles are relying on features only available with Builkit support enabled. However the current testcontainers implementation doesn't support buildkit.

Related issues

  • Stackoverflow https://stackoverflow.com/a/76501621/3636639
  • Discussion https://github.com/testcontainers/testcontainers-go/discussions/573

How to test this PR

An autotest is added which fails when the added code in docker.go is disabled and succeeds when it is enabled. Another way to test would be to use an old docker version (before API 1.39) - then the test TestBuildImageFromDockerfileBuildx will also fail.

silh avatar Apr 14 '24 12:04 silh

Deploy Preview for testcontainers-go ready!

Name Link
Latest commit b0b967f05e465357745975ba4d30978b8aec9700
Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/661bc81ed8bc020008b4c135
Deploy Preview https://deploy-preview-2482--testcontainers-go.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Apr 14 '24 12:04 netlify[bot]

I see there are some test failures related to logs output when building an image and I'll look into that.

Meanwhile, I would like to hear your opinion about enabling buildkit automatically, as I do in this PR, or maybe it should be a build option that users could specify?

silh avatar Apr 14 '24 15:04 silh