Balena CLI - docker-compose context takes into account .gitignore on deploy

Hello everyone!

I switched from custom image build to utilizing docker-compose in order to build image for my app. This approach was suggested in order to overcome another issue I was facing, more info here: (Load balancer/reverse-proxy redirects on Ktor application for public URL)

I have made the necessary changes and was able to build images locally using docker-compose up but I noticed that I couldn’t build with balena deploy MyAppName. The build was failing on the a step where I was copying a pre-built .jar file into the working directory of my container.

I was not sure why it was failing and since I had no .dockerignore file that would cause the build folder to be excluded (the one that had the prebuilt .jar), I was at a deadend.

Then I noticed that the build folder was part of .gitignore, which is correct and I explicitly excluded the folder containing the prebuilt .jar. To my surprise I was then able to build properly.

Since I could not find anything related to such a behaviour in Balena CLI docs and more specifically for balena deploy, is this something that is expected? Right now i am thinking of wrapping the build&deployment process and manually changing .gitignore to exclude the prebuilt .jar only when building with Balena, in order to avoid pushing it on Git.

Looking forward to your opinion :slight_smile:

Hi, this is a feature (https://github.com/balena-io/balena-cli/issues/889) that is due to be revisited. Keep an eye on https://github.com/balena-io/balena-cli/issues/1032 for updates.

1 Like

Hello @alexgg, thank you for sending the issue :slight_smile: will keep an eye on it and use my workaround for the moment :slight_smile: