Docker Community Forums

Share and learn in the Docker community.

Tell `docker-compose` to build a service image by running an external command

When using docker-compose, I would describe a service as

services:
  service_name:
    build: service_root

where service_root is a directory containing a Dockerfile.

However, I have a service which does not have a maintained Dockerfile, instead, a Dockerfile is generated behind the scenes by the build tool (sbt) and I would manually build the image with the build tool (sbt docker:publishLocal).

How do I tell docker-compose to obtain an image by running sbt docker:publishLocal rather than from a Dockerfile in service_root?