Michal C

when the batteries start dying we just press the buttons harder

I have mentioned building an alternative client for Klipper + Moonraker. Development of that isn’t easy, when you’re not connected to the 3D printer. I was for a lookout for an emulator. Ironically it’s the Mainsail team that solved that issue for me https://github.com/mainsail-crew/virtual-klipper-printer.

I had some problems starting it using docker compose up -d --build. Some experimentation led me to modifying the project a little bit:

diff --git a/Dockerfile b/Dockerfile
index 8713a5a..69407cf 100644
--- a/Dockerfile
+++ b/Dockerfile
[@@](https://micro.blog/@) -1,4 +1,4 [@@](https://micro.blog/@)
-FROM python:3.12-slim-bookworm AS builder
+FROM python:3.12-slim-bullseye AS builder
 
 RUN apt-get update && apt-get install -y \
     --no-install-recommends \
[@@](https://micro.blog/@) -65,7 +65,7 [@@](https://micro.blog/@) RUN git clone --depth 1 https://github.com/jacksonliam/mjpg-streamer \
 
 ## --------- This is the runner image
 
-FROM python:3.12-slim-bookworm AS runner
+FROM python:3.12-slim-bullseye AS runner
 RUN apt-get update && apt-get install -y \
     --no-install-recommends \
     --no-install-suggests \
[@@](https://micro.blog/@) -73,6 +73,7 [@@](https://micro.blog/@) RUN apt-get update && apt-get install -y \
     git \
     supervisor \
     sudo \
+    iproute2 \
     ### moonraker \
     libopenjp2-7 \
     libsodium-dev \
diff --git a/config/supervisord.conf b/config/supervisord.conf
index 295875a..48243f5 100644
--- a/config/supervisord.conf
+++ b/config/supervisord.conf
[@@](https://micro.blog/@) -53,4 +53,4 [@@](https://micro.blog/@) directory=/home/printer
 environment=LD_LIBRARY_PATH="/home/printer/mjpg-streamer"
 autostart=true
 autorestart=true
-redirect_stderr=true
\ No newline at end of file
+redirect_stderr=true
diff --git a/docker-compose.yml b/docker-compose.yml
index f446bf2..0735622 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
[@@](https://micro.blog/@) -1,7 +1,8 [@@](https://micro.blog/@)
 services:
   printer:
     container_name: printer
-    image: ghcr.io/mainsail-crew/virtual-klipper-printer:latest
+    #image: ghcr.io/mainsail-crew/virtual-klipper-printer:latest
+    build: .
     volumes:
       - ./printer_data:/home/printer/printer_data:delegated,Z
     ports:

The base Python image seemed to cause issues. Also, Moonraker needed the ip command so I’m installing iproute2.

Building this image and booting it up gives me a Moonraker server with an emulated printer. Now there’s no excuse for me to not work on the client.