Skip to content

An open source, self-hosted, real-time port monitoring and discovery tool.

fix: correct Docker image testing and health check configuration

Mostafa Wahied0fc0b09337ee
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
index 8276ba6..b7d029c 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish.yml
@@ -58,18 +58,34 @@ jobs:
- name: Test Docker image
if: github.event_name != 'pull_request'
run: |
+ # Start container with correct port and give it time to initialize
docker run --rm -d --name test-portracker \
- -e PORT=3000 \
+ -p 4999:4999 \
+ -e PORT=4999 \
-e DATABASE_PATH=/data/test.db \
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
- sleep 10
+ # Wait for startup and show logs if it fails
+ sleep 15
- if docker ps | grep test-portracker; then
- echo "✅ Container started successfully"
- docker stop test-portracker
- else
+ # Check if container is still running
+ if ! docker ps | grep test-portracker; then
echo "❌ Container failed to start or crashed"
- docker logs test-portracker || true
+ echo "📋 Container logs:"
+ docker logs test-portracker 2>/dev/null || echo "No logs available"
+ exit 1
+ fi
+
+ # Test the correct health endpoint from host
+ if curl -f http://localhost:4999/api/health; then
+ echo "✅ Health check passed"
+ else
+ echo "❌ Health check failed"
+ echo "📋 Container logs:"
+ docker logs test-portracker
+ docker stop test-portracker
exit 1
fi
+
+ echo "✅ Container test completed successfully"
+ docker stop test-portracker
diff --git a/Dockerfile b/Dockerfile
index c287b45..2343815 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -81,8 +81,8 @@ VOLUME /data
EXPOSE 3000
# Health check
-HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
- CMD wget --no-verbose --tries=1 --spider http://localhost:3000/api/servers || exit 1
+HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
+ CMD wget --no-verbose --tries=1 --spider http://localhost:4999/api/health || exit 1
# Run the application
CMD ["node", "index.js"]
\ No newline at end of file