Files
printserver/Containerfile
T
juergen 30c685e085 Print via Brother BR-Script3 PostScript instead of the vendor driver
The HL-4150CDN emulates PostScript 3, so CUPS converts client documents to PostScript and forwards them to socket://<ip>:9100. The official BR-Script3 PPD turns device options (tray, duplex, colour, media type, toner save, ...) into setpagedevice instructions. This drops the i386 multiarch runtime and the broken Brother vendor filter chain, and removes the unused Brother Linux packages from the repo.
2026-10-18 16:54:33 +02:00

78 lines
2.9 KiB
Docker

# Containerfile for a CUPS print server sharing a Brother HL-4150CDN over
# IPP/AirPrint. Build with Podman:
#
# podman build -t printserver:latest .
#
# Run with host networking so mDNS (Avahi) can advertise the printer. The
# printer is described by environment variables:
#
# podman run --rm --network host \
# -e PRINTER_IP=192.168.100.7 \
# -e PRINTER_NAME=HL-4150CDN \
# --name printserver printserver:latest
#
# PRINTER_URI can be used instead of PRINTER_IP for full control:
#
# -e PRINTER_URI=lpd://192.168.100.7/binary_p1
#
# The HL-4150CDN emulates BR-Script3 (PostScript 3). Jobs are converted to
# PostScript inside CUPS and forwarded to the printer unchanged; the official
# BR-Script3 PPD turns the queue's options (tray, duplex, colour, ...) into
# PostScript "setpagedevice" instructions. No Brother vendor binaries or 32-bit
# libraries are involved.
FROM debian:bookworm-slim
ENV DEBIAN_FRONTEND=noninteractive
# --- Task 3.1: base system, CUPS, Avahi, DBus and conversion filters -------
# cups-filters provides the PDF/PWG/URF -> PostScript filters used for
# driverless clients (AirPrint/IPP Everywhere). Ghostscript and Poppler supply
# the underlying converters.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
cups \
cups-client \
cups-filters \
avahi-daemon \
avahi-utils \
libnss-mdns \
dbus \
procps \
curl \
ghostscript \
poppler-utils \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# --- Task 3.2: install the BR-Script3 PostScript PPD -----------------------
# The PPD encodes every device option (paper source, duplex, colour/mono,
# media type, toner save, resolution, secure print) as PostScript
# "setpagedevice". CUPS's pstops filter injects the selected option code and
# the PPD's JCL entries wrap the job in PJL for the printer.
# The whole assets tree is copied because the directory name contains a space,
# which some COPY implementations cannot quote.
COPY assets /tmp/assets
RUN install -m 0644 \
"/tmp/assets/Brother HL-4150CDN/ppd/BR4150_2.PPD" \
/usr/share/cups/model/BR4150_2.PPD \
&& test -s /usr/share/cups/model/BR4150_2.PPD \
&& rm -rf /tmp/assets \
&& rm -f /etc/cups/printers.conf /etc/cups/printers.conf.O
COPY cupsd.conf /etc/cups/cupsd.conf
# CUPS needs the runtime directories to exist in the image.
RUN mkdir -p /run/cups /run/dbus /run/avahi-daemon /var/spool/cups /var/log/cups
# --- Task 3.5: startup script ----------------------------------------------
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod 0755 /usr/local/bin/entrypoint.sh
# --- Task 3.6: exposed ports -----------------------------------------------
# 631/tcp CUPS administration and IPP
# 5353/udp mDNS / DNS-SD for AirPrint discovery
EXPOSE 631/tcp
EXPOSE 5353/udp
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]