From f7dba83df501129f712afa033fe767c9b4d496aa Mon Sep 17 00:00:00 2001 From: meek2100 <34908880+meek2100@users.noreply.github.com> Date: Thu, 9 Apr 2026 13:07:38 -0700 Subject: [PATCH 1/3] Update Dockerfile --- Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 94d1612c6..95e7bff96 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,9 +37,10 @@ LABEL org.opencontainers.image.source=https://github.com/Donkie/Spoolman LABEL org.opencontainers.image.description="Keep track of your inventory of 3D-printer filament spools." LABEL org.opencontainers.image.licenses=MIT -# Install gosu for privilege dropping +# Install gosu for privilege dropping and curl for healthchecks RUN apt-get update && apt-get install -y \ gosu \ + curl \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -74,4 +75,9 @@ RUN echo "GIT_COMMIT=${GIT_COMMIT}" > build.txt \ # Run command EXPOSE 8000 + +# Add healthcheck to verify the API is responsive +HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \ + CMD curl -f http://localhost:${SPOOLMAN_PORT:-8000}/api/v1/health || exit 1 + ENTRYPOINT ["/home/app/spoolman/entrypoint.sh"] From b7d8bb692048564746bc0f81db627be8b3367423 Mon Sep 17 00:00:00 2001 From: meek2100 <34908880+meek2100@users.noreply.github.com> Date: Thu, 9 Apr 2026 13:20:50 -0700 Subject: [PATCH 2/3] Update Dockerfile with python based healthcheck. --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 95e7bff96..6411e528e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,10 +37,9 @@ LABEL org.opencontainers.image.source=https://github.com/Donkie/Spoolman LABEL org.opencontainers.image.description="Keep track of your inventory of 3D-printer filament spools." LABEL org.opencontainers.image.licenses=MIT -# Install gosu for privilege dropping and curl for healthchecks +# Install gosu for privilege dropping RUN apt-get update && apt-get install -y \ gosu \ - curl \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -76,8 +75,12 @@ RUN echo "GIT_COMMIT=${GIT_COMMIT}" > build.txt \ # Run command EXPOSE 8000 -# Add healthcheck to verify the API is responsive +# Add healthcheck to verify the API is responsive using the internal Python interpreter HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \ - CMD curl -f http://localhost:${SPOOLMAN_PORT:-8000}/api/v1/health || exit 1 + CMD python3 -c "import os, urllib.request; \ + port = os.getenv('SPOOLMAN_PORT', '8000'); \ + base = os.getenv('SPOOLMAN_BASE_PATH', '').strip('/'); \ + path = f'/{base}/api/v1/health'.replace('//', '/'); \ + urllib.request.urlopen(f'http://localhost:{port}{path}')" || exit 1 ENTRYPOINT ["/home/app/spoolman/entrypoint.sh"] From 5c07df156961a042834d0e99037daf58356945ca Mon Sep 17 00:00:00 2001 From: meek2100 <34908880+meek2100@users.noreply.github.com> Date: Thu, 9 Apr 2026 14:08:13 -0700 Subject: [PATCH 3/3] Create docker-compose.yml --- docker-compose.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..10b89afe8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '3.8' +services: + spoolman: + image: ghcr.io/donkie/spoolman:latest # Also available at dockerhub: donkieyo/spoolman:latest + restart: unless-stopped + volumes: + # Mount the host machine's ./data directory into the container's /home/app/.local/share/spoolman directory + - ./data:/home/app/.local/share/spoolman # Do NOT modify /home/app/.local/share/spoolman target + ports: + # Map the host machine's port 7912 to the container's port 8000 + - "7912:8000" + environment: + - TZ=Europe/Stockholm # Optional, defaults to UTC