Docker-cups/Dockerfile
2022-07-10 18:17:25 +02:00

71 lines
1.7 KiB
Docker

# Base Image
ARG ARCH=amd64
FROM $ARCH/debian:bullseye-slim
# Args
ARG VCS_REF
ARG BUILD_DATE
# Environment
ENV ADMIN_PASSWORD=admin
ENV ADMIN_USERNAME=admin
# Labels
LABEL maintainer="Sthope <hopelessautomations@gmail.com>" \
org.label-schema.schema-version="1.0" \
org.label-schema.name="sthopeless/cups" \
org.label-schema.description="Simple CUPS docker image" \
org.label-schema.version="0.1" \
org.label-schema.url="https://hub.docker.com/r/sthopeless/cups" \
org.label-schema.vcs-url="https://git.sthope.dev/sthope/Docker-cups" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.build-date=$BUILD_DATE
# Install Packages
RUN apt-get update \
&& apt-get install -y \
sudo \
cups \
cups-bsd \
cups-filters \
foomatic-db-compressed-ppds \
printer-driver-all \
openprinting-ppds \
hpijs-ppds \
hp-ppd \
hplip \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Add Print Username
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
ENTRYPOINT [ "docker-entrypoint.sh" ]
# Default Command
CMD ["cupsd", "-f"]
# Volumes
VOLUME ["/etc/cups"]
# Ports
EXPOSE 631