-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
75 lines (60 loc) · 2.06 KB
/
Dockerfile
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# base image
FROM debian:unstable-slim
# args
ARG TARGETPLATFORM
ARG TARGETARCH
# environment
ENV ADMIN_PASSWORD=admin
# labels
LABEL \
maintainer="ManuelKlaer" \
org.label-schema.schema-version="1.0" \
org.label-schema.name="manuelklaer/cups-canon" \
org.label-schema.description="CUPS printing server with Canon drivers (cnijfilter2)" \
org.label-schema.version="0.1" \
org.label-schema.url="https://hub.docker.com/r/manuelklaer/cups-canon" \
org.label-schema.vcs-url="https://github.com/ManuelKlaer/docker-cups-canon"
# install cups server and drivers
RUN apt update
RUN apt install -y sudo whois usbutils smbclient
RUN apt install -y cups cups-client cups-bsd cups-filters
RUN apt install -y foomatic-db-compressed-ppds
RUN apt install -y printer-driver-all printer-driver-cups-pdf
RUN apt install -y openprinting-ppds hpijs-ppds hp-ppd hplip
# add and install cnijfilter2 package
ADD ./cnijfilter2/cnijfilter2_6.70-1_${TARGETARCH}.deb /tmp/cnijfilter2.deb
RUN apt-get install -y /tmp/cnijfilter2.deb
# upgrade all packages
RUN apt update \
&& apt upgrade -y \
&& apt full-upgrade -y
# cleanup
RUN apt autoremove -y \
&& apt clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /tmp/cnijfilter2.deb
# add admin user
RUN adduser --home /home/admin --shell /bin/bash --gecos "admin" --disabled-password admin \
&& adduser admin sudo \
&& adduser admin lp \
&& adduser admin lpadmin
# disable sudo password checking
RUN echo 'admin ALL=(ALL:ALL) ALL' >> /etc/sudoers
# enable access to CUPS
RUN /usr/sbin/cupsd \
&& while [ ! -f /var/run/cups/cupsd.pid ]; do sleep 1; done \
&& cupsctl --remote-admin --remote-any --share-printers \
&& kill $(cat /var/run/cups/cupsd.pid) \
&& echo "ServerAlias *" >> /etc/cups/cupsd.conf
# copy /etc/cups for skeleton usage
RUN cp -rp /etc/cups /etc/cups-skel
# entrypoint
ADD ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod a+rwx /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT [ "/usr/local/bin/docker-entrypoint.sh" ]
# default command
CMD ["cupsd", "-f"]
# volumes
VOLUME ["/etc/cups"]
# ports
EXPOSE 631