From 2e719f402de43b6f55461317bf20cc21dc1dd9fa Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Tue, 13 Feb 2024 23:30:12 +0700 Subject: [PATCH] working distribution --- compose.yaml | 9 +++++++++ Dockerfile => printer-daemon/Dockerfile | 19 +++++++++++++------ printer-daemon/klippy.sudoers | 1 + 3 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 compose.yaml rename Dockerfile => printer-daemon/Dockerfile (69%) create mode 100644 printer-daemon/klippy.sudoers diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..858029d --- /dev/null +++ b/compose.yaml @@ -0,0 +1,9 @@ +version: '3' +services: + printer1: + build: ./printer-daemon + ports: + - "7125:7125" + - "7130:7130" + volumes: + - /var/printfarm/printer1:/opt/printstack/data diff --git a/Dockerfile b/printer-daemon/Dockerfile similarity index 69% rename from Dockerfile rename to printer-daemon/Dockerfile index 70637b6..c936e94 100644 --- a/Dockerfile +++ b/printer-daemon/Dockerfile @@ -4,9 +4,15 @@ ARG DEBIAN_FRONTEND=noninteractive ENV TZ=Asia/Bangkok # User Creation -RUN useradd -ms /bin/bash octoprint && adduser octoprint dialout -RUN useradd -ms /bin/bash klippy && adduser klippy dialout -RUN chown printeruser:printeruser /opt/printstack +RUN useradd -ms /bin/bash klippy +RUN usermod -aG dialout klippy +RUN useradd -ms /bin/bash printeruser +RUN usermod -aG dialout printeruser +RUN addgroup --system printfarm +RUN usermod -aG printfarm klippy +RUN usermod -aG printfarm printeruser +RUN mkdir /opt/printstack +RUN chown printeruser:printfarm /opt/printstack USER root # APT Dependencies @@ -38,9 +44,10 @@ RUN rm -f /bin/systemctl RUN ln -s /bin/true /bin/systemctl USER printeruser WORKDIR /opt/printstack -RUN mkdir /opt/printstack/data/klipper +RUN mkdir -p /opt/printstack/data/klipper RUN git clone https://github.com/KevinOConnor/klipper -RUN ./klipper/scripts/install-ubuntu-18.04.sh +RUN chmod +x ./klipper/scripts/install-ubuntu-22.04.sh +RUN ./klipper/scripts/install-ubuntu-22.04.sh USER root RUN rm -f /bin/systemctl @@ -55,4 +62,4 @@ RUN git clone https://github.com/Arksine/moonraker.git RUN mkdir -p /opt/printstack/data/moonraker RUN moonraker/scripts/install-moonraker.sh -d /opt/printstack/data/moonraker -z -########################## \ No newline at end of file +########################## diff --git a/printer-daemon/klippy.sudoers b/printer-daemon/klippy.sudoers new file mode 100644 index 0000000..70bc3e1 --- /dev/null +++ b/printer-daemon/klippy.sudoers @@ -0,0 +1 @@ +printeruser ALL=(ALL:ALL) NOPASSWD: ALL