From aa98029c9777a0d7c25f4f93cda6c308b998b14c Mon Sep 17 00:00:00 2001 From: Scott Date: Mon, 27 May 2024 14:04:30 +0100 Subject: [PATCH] Updated to the lastest Dockerfile --- .dockerignore | 1 - Dockerfile | 79 ++++++++++++++++++++++++++------------------------- cupsd.conf | 3 -- setup.sh | 16 ++++++----- 4 files changed, 50 insertions(+), 49 deletions(-) diff --git a/.dockerignore b/.dockerignore index e65570b..fdb474e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,3 @@ *.yml -Dockerfile *.md .github diff --git a/Dockerfile b/Dockerfile index 9acc537..f25a029 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,31 +1,44 @@ -FROM debian:bullseye +ARG MAINTAINER +FROM debian:stable-slim +MAINTAINER $MAINTAINER -# Install dependencies -RUN apt-get clean && apt-get update && apt-get install -y \ - sudo \ - whois \ - usbutils \ - cups \ - cups-client \ - cups-bsd \ - cups-filters \ - foomatic-db-compressed-ppds \ - printer-driver-all \ - openprinting-ppds \ - hpijs-ppds \ - hp-ppd \ - hplip \ - smbclient \ - printer-driver-cups-pdf \ - printer-driver-dymo \ - git \ - libcups2-dev \ - libcupsimage2-dev \ - gcc\ - g++ \ - automake \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* +# Install Packages (basic tools, cups, basic drivers, HP drivers) +RUN apt-get update \ +&& apt-get install -y \ + sudo \ + whois \ + usbutils \ + cups \ + cups-client \ + cups-bsd \ + cups-filters \ + foomatic-db-compressed-ppds \ + printer-driver-all \ + openprinting-ppds \ + hpijs-ppds \ + hp-ppd \ + hplip \ + smbclient \ + printer-driver-cups-pdf \ + printer-driver-dymo \ + git \ + libcups2-dev \ + libcupsimage2-dev \ + gcc\ + g++ \ + automake \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* + +# Add user and disable sudo password checking +RUN useradd \ + --groups=sudo,lp,lpadmin \ + --create-home \ + --home-dir=/home/print \ + --shell=/bin/bash \ + --password=$(mkpasswd print) \ + print \ +&& sed -i '/%sudo[[:space:]]/ s/ALL[[:space:]]*$/NOPASSWD:ALL/' /etc/sudoers # Install Dymo CUPS Drivers @@ -48,21 +61,11 @@ RUN cd ~/ &&\ # Expose port 631 for CUPS web interface EXPOSE 631 -# Add user and disable sudo password checking -RUN useradd \ - --groups=sudo,lp,lpadmin \ - --create-home \ - --home-dir=/home/print \ - --shell=/bin/bash \ - --password=$(mkpasswd print) \ - print \ - && sed -i '/%sudo[[:space:]]/ s/ALL[[:space:]]*$/NOPASSWD:ALL/' /etc/sudoers # Copy the default configuration file COPY --chown=root:lp cupsd.conf /etc/cups/cupsd.conf -COPY . . - +COPY setup.sh setup.sh RUN chmod +x /setup.sh # Run CUPS in the foreground diff --git a/cupsd.conf b/cupsd.conf index f35c97a..04cbf01 100644 --- a/cupsd.conf +++ b/cupsd.conf @@ -33,7 +33,6 @@ IdleExitTimeout 60 # Restrict access to the server... - Order allow,deny Allow all @@ -46,7 +45,6 @@ IdleExitTimeout 60 AuthType Default Require user @SYSTEM - Order allow,deny Allow all @@ -54,7 +52,6 @@ IdleExitTimeout 60 AuthType Default Require user @SYSTEM - Order allow,deny Allow all diff --git a/setup.sh b/setup.sh index 04b6c9e..e564942 100644 --- a/setup.sh +++ b/setup.sh @@ -1,33 +1,35 @@ #!/bin/bash # Launch cupds in the foreground -echo "Starting Cups Demon" +echo "INFO:Starting Cups Demon" /usr/sbin/cupsd -echo "Cups Information:" +echo "INFO:Cups Information:" #Print Cups Info lpinfo -v -echo "Adding Printer to Cups" +echo "INFO:Adding Printer to Cups" # Add the printer lpadmin -p dymo -v usb://DYMO/LabelWriter%20450?serial=01010112345600 -P /usr/share/cups/model/lw450.ppd -echo "Print Cups Stats" +echo "INFO:Print Cups Stats" # Stats lpstat -v -echo "Start Dymo Printer and accept new Jobs" +echo "INFO:Start Dymo Printer and accept new Jobs" # Start and Accept Jobs cupsenable dymo cupsaccept dymo -echo "Setting Default Printer" +echo "INFO:Setting Default Printer" # Set Default Printer lpoptions -d dymo -echo "Finished Setup! XD" +echo "INFO:Finished Setup! XD" # Test Print +echo "INFO:Printing Label" lp -d dymo test.txt +echo "INFO: Label Printed" # Keep the container running /usr/sbin/cupsd -f