fix: update getServiceImageDigest to retrieve image digest more reliably

- Refactored the getServiceImageDigest function to use a more robust command for fetching the Docker service image digest, improving accuracy.
- Added console logging for the current digest to aid in debugging and monitoring.
This commit is contained in:
Mauricio Siu
2025-11-18 10:09:02 -06:00
parent 46d1809f84
commit 6ba35057ac

View File

@@ -42,10 +42,14 @@ export const pullLatestRelease = async () => {
/** Returns Dokploy docker service image digest */
export const getServiceImageDigest = async () => {
const { stdout } = await execAsync(
"docker service inspect dokploy --format '{{.Spec.TaskTemplate.ContainerSpec.Image}}'",
`docker image ls --digests --format '{{.Repository}}:{{.Tag}} {{.Digest}}' | \
grep "$(docker service inspect dokploy --format '{{.Spec.TaskTemplate.ContainerSpec.Image}}')" | \
awk '{print $2}' | \
awk -F':' '{print $2}'`,
);
const currentDigest = stdout.trim().split("@")[1];
console.log("currentDigest: ", currentDigest);
if (!currentDigest) {
throw new Error("Could not get current service image digest");