SpringBoot bootBuildImage with docker-compose build?

24 Views Asked by At

Spring Boot recommends using it's Maven/Gradle plugins to build a Docker image (actually, an OCI image which is similar). From https://spring.io/guides/topicals/spring-boot-docker, with Gradle, you run:

gradle bootBuildImage --imageName=myorg/myapp

docker-compose lets you specify a build config with a Dockerfile like this:

  backend:
    image: example/database
    build:
      context: backend
      dockerfile: ../backend.Dockerfile

Is there any way for a docker-compose build to reference the Spring Boot gradle bootBuildImage step instead of a Dockerfile?

I can build a Spring Booth image with gradle bootBuildImage

I can configure a more traditional Dockerfile based image build in docker-compose with build.dockerfile.

Is there any way to specify the Spring Boot image build in a docker-compose configuration?

0

There are 0 best solutions below