Skip to content

Commit

Permalink
Updated to the lastest Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottGibb committed May 27, 2024
1 parent 7b8f5b9 commit aa98029
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 49 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
*.yml
Dockerfile
*.md
.github
79 changes: 41 additions & 38 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions cupsd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ IdleExitTimeout 60

# Restrict access to the server...
<Location />
Order allow,deny
Allow all
</Location>

Expand All @@ -46,15 +45,13 @@ IdleExitTimeout 60
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow all
</Location>

# Restrict access to log files...
<Location /admin/log>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow all
</Location>

Expand Down
16 changes: 9 additions & 7 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit aa98029

Please sign in to comment.