fix: simplify getServiceImageDigest command for improved reliability

- Refactored the getServiceImageDigest function to streamline the command used for retrieving the Docker service image digest, enhancing reliability.
- Removed unnecessary console logging for the current digest.
This commit is contained in:
Mauricio Siu
2025-11-18 22:44:42 -06:00
parent 605de97805
commit 19a01665ae

View File

@@ -42,14 +42,10 @@ export const pullLatestRelease = async () => {
/** Returns Dokploy docker service image digest */
export const getServiceImageDigest = async () => {
const { stdout } = await execAsync(
`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}'`,
"docker service inspect dokploy --format '{{.Spec.TaskTemplate.ContainerSpec.Image}}'",
);
const currentDigest = stdout.trim().split("@")[1];
console.log("currentDigest: ", currentDigest);
if (!currentDigest) {
throw new Error("Could not get current service image digest");