abergmeier
abergmeier

Reputation: 14052

Build docker image from Dockerfile using 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?

Upvotes: 14

Views: 11600

Answers (2)

Luke Gehorsam
Luke Gehorsam

Reputation: 360

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

Upvotes: 5

Pahlevi Fikri Auliya
Pahlevi Fikri Auliya

Reputation: 4517

I think it's by design not allowed due to non-hermetic nature of Dockerfile. We can RUN any command in Dockerfile, including the ones non-hermetic (can't always been reproduced)

Further discussion here:

Upvotes: 2

Related Questions