Balena CLI ignores folders called "build" "dist" etc.

I’ve just been trying to build a basic Django webserver example using Balena CLI. The webserver comes up but a load of static files are missing.

After a lot of investigation (and comparison to local docker-compose build), I discovered that all folders called “build” and “dist”, regardless of their position in the hierarchy are just being ignored by the balenaCloud builders. There may be other folders that are missing but that I haven’t spotted yet.

I have both a .gitignore and .dockerignore and neither exclude any files of this type. There doesn’t appear to be any warning, the files are simply not transferred.

Any clue on how to avoid this? If I rename the folders then there is no problem but would kind of like an exhaustive list of the folder names to avoid.

Cheers,

Linford

note: running docker-compose locally builds and runs fine

Hi, can you share a sample of the code that exhibits this issue? We’d like if possible to be able to reproduce it on our side with a basic example if possible.

Hi there.

I quickly whipped up a Dockerfile.template with the following contents:

FROM balenalib/%%BALENA_MACHINE_NAME%%-debian:latest

WORKDIR /app
COPY . /app
CMD ls -lR

I created a few directories and then pushed to a Raspberry Pi using balenaCLI and see the following output:

[Logs]    [6/2/2020, 8:51:52 AM] Restarting service 'main sha256:3401e19590b86a684eec8e72c14ce012123481ad8825b2c72d9b42a38f08630e'
[Logs]    [6/2/2020, 8:50:34 AM] [main] .:
[Logs]    [6/2/2020, 8:50:34 AM] [main] total 4
[Logs]    [6/2/2020, 8:50:34 AM] [main] -rw-r--r-- 1 root root   79 Jun  1 20:26 Dockerfile
[Logs]    [6/2/2020, 8:50:34 AM] [main] -rw-r--r-- 1 root root   90 Jun  1 20:26 Dockerfile.template
[Logs]    [6/2/2020, 8:50:34 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 a
[Logs]    [6/2/2020, 8:50:34 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 b
[Logs]    [6/2/2020, 8:50:34 AM] [main]
[Logs]    [6/2/2020, 8:50:34 AM] [main] ./a:
[Logs]    [6/2/2020, 8:50:34 AM] [main] total 1
[Logs]    [6/2/2020, 8:50:34 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 b
[Logs]    [6/2/2020, 8:50:34 AM] [main]
[Logs]    [6/2/2020, 8:50:34 AM] [main] ./a/b:
[Logs]    [6/2/2020, 8:50:34 AM] [main] total 1
[Logs]    [6/2/2020, 8:50:34 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 build
[Logs]    [6/2/2020, 8:50:34 AM] [main]
[Logs]    [6/2/2020, 8:50:34 AM] [main] ./a/b/build:
[Logs]    [6/2/2020, 8:50:34 AM] [main] total 1
[Logs]    [6/2/2020, 8:50:34 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 c
[Logs]    [6/2/2020, 8:50:34 AM] [main]
[Logs]    [6/2/2020, 8:50:34 AM] [main] ./a/b/build/c:
[Logs]    [6/2/2020, 8:50:34 AM] [main] total 1
[Logs]    [6/2/2020, 8:50:34 AM] [main] drwxr-xr-x 2 root root 1024 Jun  1 20:27 d
[Logs]    [6/2/2020, 8:50:34 AM] [main]
[Logs]    [6/2/2020, 8:50:34 AM] [main] ./a/b/build/c/d:
[Logs]    [6/2/2020, 8:50:34 AM] [main] total 0
[Logs]    [6/2/2020, 8:50:34 AM] [main] -rw-r--r-- 1 root root 0 Jun  1 20:26 file
[Logs]    [6/2/2020, 8:50:34 AM] [main]
[Logs]    [6/2/2020, 8:50:34 AM] [main] ./b:
[Logs]    [6/2/2020, 8:50:34 AM] [main] total 1
[Logs]    [6/2/2020, 8:50:34 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 c
[Logs]    [6/2/2020, 8:50:34 AM] [main]
[Logs]    [6/2/2020, 8:50:34 AM] [main] ./b/c:
[Logs]    [6/2/2020, 8:50:34 AM] [main] total 1
[Logs]    [6/2/2020, 8:50:34 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 dist
[Logs]    [6/2/2020, 8:50:34 AM] [main]
[Logs]    [6/2/2020, 8:50:34 AM] [main] ./b/c/dist:
[Logs]    [6/2/2020, 8:50:34 AM] [main] total 1
[Logs]    [6/2/2020, 8:50:34 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 d
[Logs]    [6/2/2020, 8:50:34 AM] [main]
[Logs]    [6/2/2020, 8:50:34 AM] [main] ./b/c/dist/d:
[Logs]    [6/2/2020, 8:50:34 AM] [main] total 1
[Logs]    [6/2/2020, 8:50:34 AM] [main] drwxr-xr-x 2 root root 1024 Jun  1 20:27 e
[Logs]    [6/2/2020, 8:50:34 AM] [main]
[Logs]    [6/2/2020, 8:50:34 AM] [main] ./b/c/dist/d/e:
[Logs]    [6/2/2020, 8:50:34 AM] [main] total 0
[Logs]    [6/2/2020, 8:50:34 AM] [main] -rw-r--r-- 1 root root 0 Jun  1 20:26 file
[Logs]    [6/2/2020, 8:51:51 AM] [main] .:
[Logs]    [6/2/2020, 8:51:51 AM] [main] total 4
[Logs]    [6/2/2020, 8:51:51 AM] [main] -rw-r--r-- 1 root root   79 Jun  1 20:26 Dockerfile
[Logs]    [6/2/2020, 8:51:51 AM] [main] -rw-r--r-- 1 root root   90 Jun  1 20:26 Dockerfile.template
[Logs]    [6/2/2020, 8:51:51 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 a
[Logs]    [6/2/2020, 8:51:51 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 b
[Logs]    [6/2/2020, 8:51:51 AM] [main]
[Logs]    [6/2/2020, 8:51:51 AM] [main] ./a:
[Logs]    [6/2/2020, 8:51:51 AM] [main] total 1
[Logs]    [6/2/2020, 8:51:51 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 b
[Logs]    [6/2/2020, 8:51:51 AM] [main]
[Logs]    [6/2/2020, 8:51:51 AM] [main] ./a/b:
[Logs]    [6/2/2020, 8:51:51 AM] [main] total 1
[Logs]    [6/2/2020, 8:51:51 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 build
[Logs]    [6/2/2020, 8:51:51 AM] [main]
[Logs]    [6/2/2020, 8:51:51 AM] [main] ./a/b/build:
[Logs]    [6/2/2020, 8:51:51 AM] [main] total 1
[Logs]    [6/2/2020, 8:51:51 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 c
[Logs]    [6/2/2020, 8:51:51 AM] [main]
[Logs]    [6/2/2020, 8:51:51 AM] [main] ./a/b/build/c:
[Logs]    [6/2/2020, 8:51:51 AM] [main] total 1
[Logs]    [6/2/2020, 8:51:51 AM] [main] drwxr-xr-x 2 root root 1024 Jun  1 20:27 d
[Logs]    [6/2/2020, 8:51:51 AM] [main]
[Logs]    [6/2/2020, 8:51:51 AM] [main] ./a/b/build/c/d:
[Logs]    [6/2/2020, 8:51:51 AM] [main] total 0
[Logs]    [6/2/2020, 8:51:51 AM] [main] -rw-r--r-- 1 root root 0 Jun  1 20:26 file
[Logs]    [6/2/2020, 8:51:51 AM] [main]
[Logs]    [6/2/2020, 8:51:51 AM] [main] ./b:
[Logs]    [6/2/2020, 8:51:51 AM] [main] total 1
[Logs]    [6/2/2020, 8:51:51 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 c
[Logs]    [6/2/2020, 8:51:51 AM] [main]
[Logs]    [6/2/2020, 8:51:51 AM] [main] ./b/c:
[Logs]    [6/2/2020, 8:51:51 AM] [main] total 1
[Logs]    [6/2/2020, 8:51:51 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 dist
[Logs]    [6/2/2020, 8:51:51 AM] [main]
[Logs]    [6/2/2020, 8:51:51 AM] [main] ./b/c/dist:
[Logs]    [6/2/2020, 8:51:51 AM] [main] total 1
[Logs]    [6/2/2020, 8:51:51 AM] [main] drwxr-xr-x 3 root root 1024 Jun  1 20:27 d
[Logs]    [6/2/2020, 8:51:51 AM] [main]
[Logs]    [6/2/2020, 8:51:51 AM] [main] ./b/c/dist/d:
[Logs]    [6/2/2020, 8:51:51 AM] [main] total 1
[Logs]    [6/2/2020, 8:51:51 AM] [main] drwxr-xr-x 2 root root 1024 Jun  1 20:27 e
[Logs]    [6/2/2020, 8:51:51 AM] [main]
[Logs]    [6/2/2020, 8:51:51 AM] [main] ./b/c/dist/d/e:
[Logs]    [6/2/2020, 8:51:51 AM] [main] total 0
[Logs]    [6/2/2020, 8:51:51 AM] [main] -rw-r--r-- 1 root root 0 Jun  1 20:26 file

It looks like it’s working fine to me. Are you able to share the contents of your repository? If not, a small reproduction as per @floion’s suggestion above would be great.

Cheers,
James.

Hi Guys,

Just an update on this.

I have been trying to create a reproducible example by cutting down our repository. I’ve had the same behaviour replicated several times but I kept removing things and now the problem has disapeared.

I’m not exactly sure what caused the problem to resolve - I’ve deleted loads of files/folders but I didn’t edit the .dockerignore or .gitignore files. I did remove several services from the docker-compose.yml so that there was only 1 service remaining which might have been the trigger.

I will continue to investigate over the next couple of days.

Which version of the CLI are you using?

Version 11.35.15

Hi,

Is it possible your device ran out of space? Running df -Th from the Host OS would reveal current storage capacity for each partition. Perhaps deleting additional files during your clean-up (and re-push) freed up space?

John

Hi jtonello,

I thught this initially but we’re running against balenaOS-in-container on my laptop and the entire release is only ~1Gb.

Also, it was uncanny that particular directories were missing and nothing else…

Thanks for the update @linford_bacon. Let us know if you continue to have problems.