Since the image is built with flyctl it would need to save the git sha or whatever else you want to the image. You can do it with something like this:
flyctl deploy —build-arg COMMIT=$(git rev-parse HEAD)
Then in your image, add
ARG COMMIT
ENV COMMIT=$COMMIT