mirror of
https://github.com/nikdoof/cups-avahi-airprint.git
synced 2025-12-11 18:12:16 +00:00
Changed to Alpine base and removed Brother drivers. Generic postscript
works just fine.
This commit is contained in:
34
Dockerfile
34
Dockerfile
@@ -1,16 +1,29 @@
|
||||
FROM ubuntu:bionic
|
||||
|
||||
# Add repos
|
||||
RUN echo 'deb [trusted=yes] http://www.openprinting.org/download/printdriver/debian/ lsb3.2 main contrib main-nonfree' >> /etc/apt/sources.list.d/multiverse.list
|
||||
FROM alpine:latest
|
||||
|
||||
# Install the packages we need. Avahi will be included
|
||||
RUN apt-get update && apt-get install -y \
|
||||
brother-lpr-drivers-extra brother-cups-wrapper-extra openprinting-ppds-postscript-brother\
|
||||
cups \
|
||||
cups-pdf \
|
||||
RUN echo "http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories &&\
|
||||
apk add --update cups cups-libs cups-pdf cups-client \
|
||||
cups-filters \
|
||||
cups-dev \
|
||||
ghostscript \
|
||||
avahi \
|
||||
inotify-tools \
|
||||
python-cups \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
python \
|
||||
python-dev \
|
||||
py-pip \
|
||||
build-base \
|
||||
wget \
|
||||
&& pip --no-cache-dir install --upgrade pip \
|
||||
&& pip install pycups \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
#RUN apt-get update && apt-get install -y \
|
||||
# brother-lpr-drivers-extra brother-cups-wrapper-extra openprinting-ppds-postscript-brother\
|
||||
# cups \
|
||||
# cups-pdf \
|
||||
# inotify-tools \
|
||||
# python-cups \
|
||||
#&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# This will use port 631
|
||||
EXPOSE 631
|
||||
@@ -35,4 +48,3 @@ RUN sed -i 's/Listen localhost:631/Listen 0.0.0.0:631/' /etc/cups/cupsd.conf &&
|
||||
sed -i 's/.*enable\-dbus=.*/enable\-dbus\=no/' /etc/avahi/avahi-daemon.conf && \
|
||||
echo "ServerAlias *" >> /etc/cups/cupsd.conf && \
|
||||
echo "DefaultEncryption Never" >> /etc/cups/cupsd.conf
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# chuckcharlie/cups-airprint-brother
|
||||
# chuckcharlie/cups-avahi-airprint
|
||||
|
||||
Fork from [quadportnick/docker-cups-airprint](https://github.com/quadportnick/docker-cups-airprint)
|
||||
|
||||
This Ubuntu-based Docker image runs a CUPS instance that is meant as an AirPrint relay for printers that are already on the network but not AirPrint capable. The other images out there never seemed to work right and didn't support many Brother printers. I forked the original to add more printer support, use the latest Ubuntu base, and work on more host OS's.
|
||||
This Alpine-based Docker image runs a CUPS instance that is meant as an AirPrint relay for printers that are already on the network but not AirPrint capable. The other images out there never seemed to work right. I forked the original to use the Alpine instead of Ubuntu and work on more host OS's.
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -24,10 +24,11 @@ docker run --name cups --restart unless-stopped --net host\
|
||||
-v <your config dir>:/config \
|
||||
-e CUPSADMIN="<username>" \
|
||||
-e CUPSPASSWORD="<password>" \
|
||||
chuckcharlie/cups-airprint-brother:latest
|
||||
chuckcharlie/cups-avahi-airprint:latest
|
||||
```
|
||||
|
||||
## Add and set up printer:
|
||||
* CUPS will be configurable at http://[host ip]:631 using the CUPSADMIN/CUPSPASSWORD.
|
||||
* Make sure you select `Share This Printer` when configuring the printer in CUPS.
|
||||
* ***After configuring your printer, you need to close the web browser for at least 60 seconds. CUPS will not write the config files until it detects the connection is closed for as long as a minute.***
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
inotifywait -m -e close_write,moved_to,create /etc/cups |
|
||||
#!/bin/sh
|
||||
/usr/bin/inotifywait -m -e close_write,moved_to,create /etc/cups |
|
||||
while read -r directory events filename; do
|
||||
if [ "$filename" = "printers.conf" ]; then
|
||||
rm -rf /services/AirPrint-*.service
|
||||
|
||||
@@ -3,18 +3,19 @@ set -e
|
||||
set -x
|
||||
|
||||
if [ $(grep -ci $CUPSADMIN /etc/shadow) -eq 0 ]; then
|
||||
useradd -r -G lpadmin -M $CUPSADMIN
|
||||
adduser -S -G lpadmin --no-create-home $CUPSADMIN
|
||||
fi
|
||||
echo $CUPSADMIN:$CUPSPASSWORD | chpasswd
|
||||
|
||||
mkdir -p /config/ppd
|
||||
mkdir -p /services
|
||||
rm -rf /etc/avahi/services/*
|
||||
rm -rf /etc/cups/ppd
|
||||
ln -s /config/ppd /etc/cups
|
||||
if [ ls /services/*.service ]; then
|
||||
if [ `ls -l /services/*.service 2>/dev/null | wc -l` -gt 0 ]; then
|
||||
cp -f /services/*.service /etc/avahi/services/
|
||||
fi
|
||||
if [ ! -f /config/printers.conf ]; then
|
||||
if [ `ls -l /config/printers.conf 2>/dev/null | wc -l` -eq 0 ]; then
|
||||
touch /config/printers.conf
|
||||
fi
|
||||
cp /config/printers.conf /etc/cups/printers.conf
|
||||
|
||||
Reference in New Issue
Block a user