goofball222 / factorio

Factorio headless server Docker container
Apache License 2.0
47 stars 14 forks source link

For automation: How can I tell when your docker hub image has updated? #4

Closed bplein closed 5 years ago

bplein commented 5 years ago

This is more of a "how do I" vs. a bug report.

Using some other images, I can pull the tags (which correspond to the software version, i.e. 0.17.8) and see if I'm running the latest. Currently you just update the "experimental" tag and I don't see an easy way to see if it's new.

The use case here is I poll in the background periodically. If a new version is out, then I message each server (using RCON) to say that the server is going to be restarted with a new version, I issue a save on that server to ensure that the current game is saved, then I do (essentially) a docker-compose pull, down, rm, and up. Yes, I could just pull and then up.

In any event, is there a way that you know that I can test the latest image for the version of software it's built on? Looking at Github probably isn't the right thing to do as it's possible that Github changes and Docker Hub isn't yet updated.

Ideas?

goofball222 commented 5 years ago

Currently the Docker cloud/hub build process pulls the VERSION file containing the Factorio version into the image labels when built. You can grab that from the image formatted into a single parsable line via:

docker inspect \
    --format '{{ index .Config.Labels "org.label-schema.version"}}' \
    goofball222/factorio:experimental

Beyond that I'll have to go back and see if the Docker cloud automatic build process has fixed their post build hook process to where it can push multi-tag images. Last time I tried it was horribly broken...

bplein commented 5 years ago

This is workable. Do you know if that docker command reads from the registry or the local image? If the latter then I’ll just do a periodic pull and inspect.