Dockerfile 1.59 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
FROM golang:1.13 AS builder
MAINTAINER opl@deichman.no
WORKDIR /app
COPY kohaprinter.* .
RUN CGO_ENABLED=0 go build -o kohaprinter


FROM debian:testing

# Install Packages (basic tools, cups, basic drivers, HP drivers)
RUN apt-get update &&\
    dpkg --add-architecture i386 &&\
    apt-get install -y \
    sudo whois cups cups-client cups-bsd cups-filters foomatic-db-compressed-ppds printer-driver-all openprinting-ppds \
    hpijs-ppds hp-ppd hplip smbclient &&\
    apt-get clean

# 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

# Kohaprinter backend and extra cups drivers
COPY --from=builder /app/kohaprinter /usr/lib/cups/backend/
COPY drivers /
COPY config/ /etc/cups/
RUN chown .lp /etc/cups/ppd/*.ppd
# RUN dpkg -i --force-architecture ql720nwlpr-1.0.1-1.i386.deb
#     dpkg -i --force-architecture ql720nwcupswrapper-1.0.1-1.i386.deb
#     cp /usr/lib/cups/filter/brlpdwrapper* /usr/lib64/cups/filter
#     cp /usr/lib/cups/filter/brlpdwrapper* /usr/lib64/cups/filter

# Extra ppds
#COPY ./ppd/* /usr/share/cups/model/


# Configure the service's to be reachable
# RUN /usr/sbin/cupsd &&\
#   while [ ! -f /var/run/cups/cupsd.pid ]; do sleep 1; done &&\
#   cupsctl --remote-admin --share-printers &&\
#   kill $(cat /var/run/cups/cupsd.pid)

RUN dpkg -i --force-all --force-architecture /ql720nwpdrv-3.1.5-0.i386.deb && apt-get clean &&\
    rm -rf /var/lib/apt/lists/*

COPY startCups.sh /
CMD ["/startCups.sh"]