Accepting request 994320 from home:kukuk:container

OBS-URL: https://build.opensuse.org/request/show/994320
OBS-URL: https://build.opensuse.org/package/show/devel:microos:containers/cups-image?expand=0&rev=1
This commit is contained in:
Thorsten Kukuk 2022-08-10 12:05:21 +00:00 committed by Git OBS Bridge
commit bda9b3a463
7 changed files with 146 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

60
Dockerfile Normal file
View File

@ -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

36
README.md Normal file
View File

@ -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
```

10
_service Normal file
View File

@ -0,0 +1,10 @@
<services>
<service mode="buildtime" name="kiwi_metainfo_helper"/>
<service mode="buildtime" name="docker_label_helper"/>
<service name="replace_using_package_version" mode="buildtime">
<param name="file">Dockerfile</param>
<param name="regex">%PKG_VERSION%</param>
<param name="parse-version">patch</param>
<param name="package">cups</param>
</service>
</services>

4
cups-image.changes Normal file
View File

@ -0,0 +1,4 @@
-------------------------------------------------------------------
Wed Aug 10 08:30:08 UTC 2022 - Thorsten Kukuk <kukuk@suse.com>
- Initial version

12
docker-entrypoint.sh Normal file
View File

@ -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 "$@"