sdf
All checks were successful
Build and push Docker image / build (push) Successful in 41s

This commit is contained in:
2025-10-01 01:02:11 +04:00
parent 09b7669e52
commit 4ad63abcd9

View File

@@ -5,10 +5,10 @@ const app = express()
const PORT = 8080 const PORT = 8080
const docker = new Docker({ socketPath: '/var/run/docker.sock' }) const docker = new Docker({ socketPath: '/var/run/docker.sock' })
async function getServiceStatusCode(serviceName) { async function getServiceStatusCode(service_name) {
try { try {
const service = docker.getService(serviceName) const service = docker.getService(service_name)
const tasks = await service.tasks({ filters: { service: [serviceName] } }) const tasks = await service.tasks({ filters: { service: [service_name] } })
if (tasks.length === 0) { if (tasks.length === 0) {
return 503 return 503
@@ -27,6 +27,8 @@ async function getServiceStatusCode(serviceName) {
return isHealthy ? 200 : 503 return isHealthy ? 200 : 503
} catch (error) { } catch (error) {
console.error(error.message)
if (error.statusCode === 404) { if (error.statusCode === 404) {
return 404 return 404
} }