Prevent Redownload of unmodified containers

So I use a raspberrry pi 3b+ with the 64bit balenaOS image. this serves as my octopi server. I then run code-server so I can access my octopi server files as needed.

I recently deployed a krist miner (cryptocurrently for minecraft, holds no real world value), and noticed that when I deployed it with this config

# ./krist-miner/Dockerfile
FROM golang:alpine3.14

ENV WALLET=k33twky32z

RUN apk update
RUN go install github.com/1lann/krist-miner/cpu-miner@latest

CMD ["sh", "-c", "cpu-miner ${WALLET}"]
# unnessecary code for example removed
version: '2'
services
  krist-miner:
    build: ./krist-miner
    container_name: krist
    environment:
      - WALLET=k6kfp19v9k
    restart: unless-stopped

I noticed that it rebuilt the un-modified containers alongside the new one. forcing my pi to download 1.7 gigabytes of data. And it does this every time I make a small config, such as changing an environment variable in a container.

Is there a way I can prevent it from re-building/downloading unmodified containers? My local folder containing my balena config, is a git enabled folder with a git repository on gitlab.

Delta updates should be standard if you are running a recent version of balenaOS Delta updates - Balena Documentation

So if you haven’t changed anything in the container it shouldn’t download anything at all AFAIK

Guessing it might be a typo but in the above it should be services: not services

Hi @merith-tk,

By what mechanism do you tell that the Pi is downloading 1.7Gb of data per config change? Could you paste an example of this, such as logs or networking monitoring? Thanks!

Regards,
Christina

I’d suggest specifying the WALLET env var via balena’s Device Variables section on the dashboard, instead of adding it to the dockerfile. I’m guessing you are modifying WALLET and running balena push again, and you can avoid this by using an env var from the dashboard instead.

The “storage” meter on the dashboard, it reaches nearly full when updating and sits around 1.3gb used now, but when it updates it doubles before it is finnished downloading the updates and then deleting the old one

and the WALLET env is fixed basically, the problem comes from when I tweak even the tiniest setting anywhere in Dockerfile or docker-compose.yml