Deploy from docker-compose mixing build and image flags

This might be more appropriate under balena cli, but I didn’t see that as a standalone category.

I have the following docker-compose.yml that I am deploying with like the following: balena deploy myApp.

My docker-compose.yml is as follows:

version: '2'

services:
  service1:
    image: <google-container-registry-image>

  service2:
    build:
      context: /Users/me/dev/some/path/rootOfService2

service1 is a Java application that is built with jib. I’m building that container in a separate step and then just pulling from my container registry. service2 is a simpler python container. I’d like to be able to specify an absolute path (ideally, with a env variable) for the build context and build the container using balena deploy. The path that I’m specifying containers a Dockerfile for service2.

This is the error the CLI gives me:

$ balena deploy myApp
[Info]    Compose file detected
[Info]    Building for aarch64/raspberrypi4-64
[Info]    Docker Desktop detected (daemon architecture: "x86_64")
[Info]      Docker itself will determine and enable architecture emulation if required,
[Info]      without balena-cli intervention and regardless of the --emulated option.
[Build]   Built 1 service in 0 seconds
[Build]   <service2> Preparing...
[Error]   Deploy failed
Could not find a Dockerfile for this service

Additional information may be available by setting a DEBUG=1 environment
variable: "set DEBUG=1" on a Windows command prompt, or "export DEBUG=1"
on Linux or macOS.

If you need help, don't hesitate in contacting our support forums at
https://forums.balena.io

For bug reports or feature requests, have a look at the GitHub issues or
create a new one at: https://github.com/balena-io/balena-cli/issues/

Any ideas? Is this combination of using a prebuilt image and building another image supported? Am I deviating too far from the recommended balena workflow/project hierarchy?

Thanks for taking a look.

exporting the DEBUG=1 gives me this CLI output:

$ balena deploy myApp
[debug] original argv0="/usr/local/lib/balena-cli/bin/node" argv=[/usr/local/lib/balena-cli/bin/node,/usr/local/lib/balena-cli/bin/run,deploy,my
app] length=4
[Debug]   Parsing input...
[Debug]   Loading project...
[Debug]   Resolving project...
[Info]    Compose file detected
[Debug]   Creating project...
[Info]    Building for aarch64/raspberrypi4-64
[Info]    Docker Desktop detected (daemon architecture: "x86_64")
[Info]      Docker itself will determine and enable architecture emulation if required,
[Info]      without balena-cli intervention and regardless of the --emulated option.
[Debug]   Found build tasks:
[Debug]       service2: build [/Users/me/dev/some/path/rootOfService2]
[Debug]   Resolving services with [raspberrypi4-64|aarch64]
[Build]   Built 1 service in 0 seconds
[Build]   service2 Preparing...
[Error]   Deploy failed
Error: Could not find a Dockerfile for this service
    at /usr/local/lib/balena-cli/node_modules/resin-bundle-resolve/build/index.js:93:32
    at Generator.next (<anonymous>)
    at /usr/local/lib/balena-cli/node_modules/resin-bundle-resolve/build/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/usr/local/lib/balena-cli/node_modules/resin-bundle-resolve/build/index.js:4:12)
    at resolveTarStreamOnFinish (/usr/local/lib/balena-cli/node_modules/resin-bundle-resolve/build/index.js:87:12)
    at Object.<anonymous> (/usr/local/lib/balena-cli/node_modules/resin-bundle-resolve/build/index.js:49:19)
    at Generator.next (<anonymous>)
    at /usr/local/lib/balena-cli/node_modules/resin-bundle-resolve/build/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/usr/local/lib/balena-cli/node_modules/resin-bundle-resolve/build/index.js:4:12)
    at Extract.extract.once (/usr/local/lib/balena-cli/node_modules/resin-bundle-resolve/build/index.js:47:34)
    at Object.onceWrapper (events.js:286:20)
    at Extract.emit (events.js:203:15)
    at Extract.EventEmitter.emit (domain.js:448:20)
    at finishMaybe (/usr/local/lib/balena-cli/node_modules/resin-bundle-resolve/node_modules/readable-stream/lib/_stream_writable.js:620:14)
    at /usr/local/lib/balena-cli/node_modules/resin-bundle-resolve/node_modules/readable-stream/lib/_stream_writable.js:595:5
    at Extract._final (/usr/local/lib/balena-cli/node_modules/resin-bundle-resolve/node_modules/tar-stream/extract.js:254:3)
    at callFinal (/usr/local/lib/balena-cli/node_modules/resin-bundle-resolve/node_modules/readable-stream/lib/_stream_writable.js:586:10)
    at process._tickCallback (internal/process/next_tick.js:63:19)

If you need help, don't hesitate in contacting our support forums at
https://forums.balena.io

For bug reports or feature requests, have a look at the GitHub issues or
create a new one at: https://github.com/balena-io/balena-cli/issues/

Here is a ticket that represents that may relate: https://github.com/balena-io/balena-cli/issues/1338

Hey there, indeed the ticket above seems related. We ll keep you posted on this. Cheers!