From af6a088e069716d12ffe086733f7d9d683b0e8d2 Mon Sep 17 00:00:00 2001 From: kukuk <> Date: Aug 10 2022 15:36:59 +0000 Subject: Update cups-image to rev 1 via SR 994324 https://build.opensuse.org/request/show/994324 by user kukuk + dimstar_suse cups image --- diff --git a/.files b/.files new file mode 100644 index 0000000..99dd2b5 Binary files /dev/null and b/.files differ diff --git a/.meta b/.meta new file mode 100644 index 0000000..65dfe97 --- /dev/null +++ b/.meta @@ -0,0 +1,5 @@ + + + + + diff --git a/.rev b/.rev new file mode 100644 index 0000000..f09477e --- /dev/null +++ b/.rev @@ -0,0 +1,10 @@ + + + 820588c22ee134e4bc7be073dadbfa97 + unknown + + dimstar_suse + cups image + 994324 + + diff --git a/.servicemark b/.servicemark new file mode 100644 index 0000000..231a012 --- /dev/null +++ b/.servicemark @@ -0,0 +1 @@ +739d81f1a0995e4d99916cb40cbaebcf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b16a2c1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: MIT +#!BuildTag: opensuse/cups:%PKG_VERSION% +#!BuildTag: opensuse/cups:latest +#!BuildTag: opensuse/cups:%PKG_VERSION%-%RELEASE% +FROM opensuse/tumbleweed:latest + +MAINTAINER openSUSE (https://www.opensuse.org/) + +# Define labels according to https://en.opensuse.org/Building_derived_containers +# labelprefix=org.opensuse.application.cups +LABEL org.opencontainers.image.title="openSUSE Tumbleweed Cups Server Container Image" +LABEL org.opencontainers.image.description="Cups Server, based on the SLE Base Container Image." +LABEL org.opencontainers.image.version="%PKG_VERSION%" +LABEL org.opencontainers.image.url="https://www.opensuse.org" +LABEL org.opencontainers.image.created="%BUILDTIME%" +LABEL org.opencontainers.image.vendor="openSUSE Project" +LABEL org.opensuse.reference="registry.opensuse.org/opensuse/cups:%PKG_VERSION%-%RELEASE%" +LABEL org.openbuildservice.disturl="%DISTURL%" + +LABEL com.suse.release-stage="released" +# endlabelprefix + +RUN set -euo pipefail; zypper -n in --no-recommends cups manufacturer-PPDs OpenPrintingPPDs; zypper -n clean; rm -rf /var/log/* + +ENTRYPOINT ["docker-entrypoint.sh"] +CMD ["/usr/sbin/cupsd", "-f"] + +COPY docker-entrypoint.sh /usr/local/bin/ +RUN set -euo pipefail; chmod 755 /usr/local/bin/docker-entrypoint.sh + +# Add user and disable sudo password checking +RUN useradd \ + --groups=root \ + --create-home \ + --shell=/bin/bash \ + admin + +# log to stderr +RUN set -euo pipefail; \ + sed -i -e "s|^AccessLog .*|AccessLog stderr|g" \ + -e "s|^ErrorLog .*|ErrorLog stderr|g" \ + -e "s|^PageLog .*|PageLog stderr|g" \ + /etc/cups/cups-files.conf + +# enable access to CUPS +RUN set -euo pipefail; /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 set -euo pipefail; cp -rp /etc/cups /etc/cups-skel + +# volumes +VOLUME /etc/cups + +# port +EXPOSE 631 + diff --git a/README.md b/README.md new file mode 100644 index 0000000..c8e54de --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# CUPS Docker Image + +## Description + +This container image contains the latest cups server from openSUSE Tumbleweed. + +## Usage + +### Start the container + +```bash + +podman run -d --rm -p 631:631 --name cups registry.opensuse.org/opensuse/cups:latest + +``` + +### Configuration + +This CUPS container comes with a default cups configuration which allows remote access for adminitration. An own configuration can be provided as volume: `-v /srv/cups:/etc/cups`, where the example assumes you have your cups configuration stored in `/srv/cups`. + +For further configuration, login to the CUPS web interface on port 631 (e.g. +`https://localhost:631`) and configure CUPS to your need. +*IMPORTANT*: you need to use `https://`, else cups will do a wrong redirect! + +The default administration account is: `admin` + +For security reasons there is no default password, it has to be set with +the environment variable _ADMIN_PASSWORD_. + +```bash + +podman run -d --rm -p 631:631 -v /srv/cups:/etc/cups -e ADMIN_PASSWORD=mySecretPassword --name cups registry.opensuse.org/opensuse/cups:latest + +``` + + diff --git a/_service b/_service new file mode 100644 index 0000000..a4176cd --- /dev/null +++ b/_service @@ -0,0 +1,10 @@ + + + + + Dockerfile + %PKG_VERSION% + patch + cups + + diff --git a/cups-image.changes b/cups-image.changes new file mode 100644 index 0000000..c1337b7 --- /dev/null +++ b/cups-image.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Wed Aug 10 08:30:08 UTC 2022 - Thorsten Kukuk + +- Initial version diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..57b394f --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash -e + +if [ -n "${ADMIN_PASSWORD}" ]; then + echo -e "${ADMIN_PASSWORD}\n${ADMIN_PASSWORD}" | passwd admin +fi + +if [ ! -f /etc/cups/cupsd.conf ]; then + cp -rpn /etc/cups-skel/* /etc/cups/ +fi + +exec "$@" +