Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build docker image from Dockerfile using Bazel

Tags:

docker

bazel

I have a fairly simple Dockerfile and now would like to build a docker image using rules_docker. Trying to use container_image, it seems like I cannot use the Dockerfile as input. Is there any way to build with a Dockerfile?

like image 900
abergmeier Avatar asked Dec 21 '17 14:12

abergmeier


People also ask

Can Bazel build Docker images?

Alternatively, you can build a docker load compatible bundle with: bazel build my/image:helloworld. tar . This will produce a tar file in your bazel-out directory that can be loaded into your local Docker client. Building this target can be expensive for large images.

What is Bazel Docker?

Bazel is a fast, scalable, multi-language, and extensible build system. Skaffold can help build artifacts using Bazel locally; after Bazel finishes building container images, they will be loaded into the local Docker daemon.


1 Answers

Update: There is now a rule called dockerfile_image. Read here for more details: https://github.com/bazelbuild/rules_docker/blob/master/contrib/dockerfile_build.bzl#L15

like image 128
Luke Gehorsam Avatar answered Sep 20 '22 17:09

Luke Gehorsam