[CUPS] Rewrite based on @zajac-grzegorz work (#218)

* [CUPS] Rewrite based on @zajac-grzegorz work

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Max Winterstein
2023-11-16 22:52:44 +01:00
committed by GitHub
parent 932affd371
commit 273efd5db2
29 changed files with 174 additions and 180 deletions

View File

@@ -1,37 +1,51 @@
ARG BUILD_FROM
FROM $BUILD_FROM
LABEL io.hass.version="1" io.hass.type="addon" io.hass.arch="armhf|aarch64|i386|amd64"
LABEL io.hass.version="1.0" io.hass.type="addon" io.hass.arch="aarch64|amd64"
# Set shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
sudo \
locales \
cups \
avahi-daemon \
libnss-mdns \
dbus \
colord \
printer-driver-all-enforce \
printer-driver-all \
printer-driver-gutenprint \
openprinting-ppds \
hpijs-ppds \
hp-ppd \
hplip \
printer-driver-foo2zjs \
cups-pdf \
gnupg2 \
lsb-release \
nano \
samba \
bash-completion \
nginx \
procps \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
COPY rootfs /
# Corrects permissions for s6 v3
RUN if [ -d /etc/cont-init.d ]; then chmod -R 755 /etc/cont-init.d; fi && \
if [ -d /etc/services.d ]; then chmod -R 755 /etc/services.d; fi && \
if [ -f /entrypoint.sh ]; then chmod 755 /entrypoint.sh; fi
# 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
EXPOSE 631 445 137 139
EXPOSE 631
RUN chmod a+x /run.sh
CMD ["/run.sh"]