commit ea024b830b84c4868a643ecd206b3a7f1d4d649d Author: Markus Pesch Date: Sun May 26 21:16:19 2019 +0200 Initial Commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b53e68c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = false + +[Makefile] +indent_style = tab \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..4d183c3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +**/Makefile text eol=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e3382f9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +services: + - docker + +script: + - make push diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..11e53db --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# Base-Image +FROM ubuntu:18.04 + +# Environment +ENV CUPS_ADMIN_USER=print +ENV CUPS_ADMIN_PASSWD=print + +# Labels +LABEL maintainer="Markus Pesch" + +# Non-Interactive +ENV DEBIAN_FRONTEND="noninteractive" + +# Software installation +RUN apt-get update && \ + apt-get upgrade --yes && \ + apt-get install --yes \ + sudo \ + cups \ + cups-client \ + cups-bsd \ + cups-filters \ + foomatic-db-compressed-ppds \ + printer-driver-all \ + openprinting-ppds \ + hpijs-ppds \ + hp-ppd \ + hplip && \ + rm -rf /var/lib/apt/lists/* + +COPY entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh + +ENTRYPOINT [ "/usr/local/bin/entrypoint.sh"] \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..209e997 --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +# VERSION +# If no version is specified as a parameter of make, the last git hash +# value is taken. +VERSION?=latest + +# DOCKER_USER +DOCKER_USER?=volkerraschek + +build: + docker build \ + --tag ${DOCKER_USER}/cupsd:${VERSION} \ + . + +push: build + docker login --username ${DOCKER_USER} --password ${DOCKER_PASSWORD} + docker push ${DOCKER_USER}/cupsd:${VERSION} diff --git a/README.md b/README.md new file mode 100644 index 0000000..261d90b --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# cups +Common Unix Printing System (CUPS), is the most widely used printing system on Linux +systems. CUPS allows you to use, manage and share many printers on the network, +as it is designed as a client/server system. + +This repository contains only build scripts for the CUPS daemon. + +## Usage +To start cups directly over cli: + +```bash +docker run \ + --detach \ + --env CUPS_ADMIN_USER=print \ + --env CUPS_ADMIN_PASSWD=print \ + --network=host \ + --volume /var/run/dbus:/var/run/dbus \ + --name cupsd \ + volkerraschek/cupsd +``` + +or if you want to use a `docker-compose.yml` + +```yaml +version: '3' +services: + cupsd: + container_name: cupsd + environment: + - CUPS_ADMIN_USER=print + - CUPS_ADMIN_PASSWD=print + network_mode: host + restart: always + volumes: + - /var/run/dbus:/var/run/dbus +``` + +After starting the container, cups is available over http://localhost:631 \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..10d63f4 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +useradd \ + --groups=sudo,lp,lpadmin \ + --create-home \ + --home-dir=/home/${CUPS_ADMIN_USER} \ + --shell=/bin/bash \ + ${CUPS_ADMIN_USER} + +echo "${CUPS_ADMIN_USER}:${CUPS_ADMIN_PASSWD}" | chpasswd + +sed --in-place '/%sudo[[:space:]]/ s/ALL[[:space:]]*$/NOPASSWD:ALL/' /etc/sudoers + +/usr/sbin/cupsd -f \ No newline at end of file