Creating resin-updates.lock from the Dockerfile?

Hi! Does it make sense to create the resin-updates.lock file in the /data directory from the Docker file?

I have something like this:

COPY .resin-updates.lock /data/resin-updates.lock

But it doesn’t work. I suspect the /data directory is overwritten or cleared up so it’s not supposed to be touched at this point?

What would be a good place to create the resin-updates.lock if we want this to be in all our devices?

Thanks!
Flavia

Hi Flavia,

The /data directory is not mounted when your project is building on our build server, so you can’t access it from your Dockerfile. The /data volume only exists when the container is running on the deployed devices.

I would suggest copying to /usr/src/app during the build and then having a start script that runs on the device to copy the file across to /data.

You can find some info in the docs https://docs.resin.io/runtime/runtime/#persistent-storage

Hi @flavia, one other way to do setting up a lockfile from the Dockerfile is to add it to the CMD step, combined it with calling the start script of your application, something like:

CMD touch /data/resin-updates.lock && bash start.sh

This would explicitly lock updates (easy to find the fact in the Dockerfile), and happens at the right time, when the application starts.

@joe @imrehg Thanks for the explanation, link and example.

I tried an example with CMD like @imrehg suggested and it worked like a charm :slight_smile:

1 Like

brilliant! :slight_smile: how big of a fleet are you working with?

Sorry, forgot to answer this one. We have over 40 devices at the moment, and growing.

1 Like