improve usability
This commit is contained in:
parent
40c2c99474
commit
85b0b173f9
@ -9,23 +9,24 @@ stages:
|
|||||||
before_script:
|
before_script:
|
||||||
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
|
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
|
||||||
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||||
|
- export DOCKER_BUILD_ARGS="--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --build-arg VCS_REF=`git rev-parse --short HEAD`"
|
||||||
|
|
||||||
build-amd64:
|
build-amd64:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- docker build --build-arg ARCH=amd64 -t ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-amd64 .
|
- docker build --build-arg ARCH=amd64 $DOCKER_BUILD_ARGS -t ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-amd64 .
|
||||||
- docker push ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-amd64
|
- docker push ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-amd64
|
||||||
|
|
||||||
build-arm32v7:
|
build-arm32v7:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- docker build --build-arg ARCH=arm32v7 -t ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v7 .
|
- docker build --build-arg ARCH=arm32v7 $DOCKER_BUILD_ARGS -t ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v7 .
|
||||||
- docker push ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v7
|
- docker push ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v7
|
||||||
|
|
||||||
build-arm64v8:
|
build-arm64v8:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- docker build --build-arg ARCH=arm64v8 -t ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm64v8 .
|
- docker build --build-arg ARCH=arm64v8 $DOCKER_BUILD_ARGS -t ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm64v8 .
|
||||||
- docker push ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm64v8
|
- docker push ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm64v8
|
||||||
|
|
||||||
release:
|
release:
|
||||||
|
69
Dockerfile
69
Dockerfile
@ -1,34 +1,49 @@
|
|||||||
# Base image
|
# args
|
||||||
ARG ARCH=amd64
|
ARG ARCH=amd64
|
||||||
|
ARG VCS_REF
|
||||||
|
ARG BUILD_DATE
|
||||||
|
|
||||||
|
# base image
|
||||||
FROM $ARCH/debian:buster-slim
|
FROM $ARCH/debian:buster-slim
|
||||||
|
|
||||||
# Maintainer
|
# environment
|
||||||
MAINTAINER Florian Schwab <me@ydkn.io>
|
ENV ADMIN_PASSWORD=admin
|
||||||
|
|
||||||
|
# labels
|
||||||
|
LABEL maintainer="Florian Schwab <me@ydkn.io>" \
|
||||||
|
org.label-schema.schema-version="1.0" \
|
||||||
|
org.label-schema.name="ydkn/cups" \
|
||||||
|
org.label-schema.description="Simple CUPS docker image" \
|
||||||
|
org.label-schema.version="0.1" \
|
||||||
|
org.label-schema.url="https://hub.docker.com/r/ydkn/cups" \
|
||||||
|
org.label-schema.vcs-url="https://gitlab.com/ydkn/docker-cups" \
|
||||||
|
org.label-schema.vcs-ref=$VCS_REF \
|
||||||
|
org.label-schema.build-date=$BUILD_DATE
|
||||||
|
|
||||||
# install packages
|
# install packages
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y \
|
&& apt-get install -y \
|
||||||
sudo \
|
sudo \
|
||||||
cups \
|
cups \
|
||||||
cups-bsd \
|
cups-bsd \
|
||||||
cups-filters \
|
cups-filters \
|
||||||
foomatic-db-compressed-ppds \
|
foomatic-db-compressed-ppds \
|
||||||
printer-driver-all \
|
printer-driver-all \
|
||||||
openprinting-ppds \
|
openprinting-ppds \
|
||||||
hpijs-ppds \
|
hpijs-ppds \
|
||||||
hp-ppd \
|
hp-ppd \
|
||||||
hplip \
|
hplip \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# add print user
|
# add print user
|
||||||
RUN adduser --home /home/print --shell /bin/bash --gecos "print" --disabled-password print \
|
RUN adduser --home /home/admin --shell /bin/bash --gecos "admin" --disabled-password admin \
|
||||||
&& adduser print sudo \
|
&& adduser admin sudo \
|
||||||
&& adduser print lp \
|
&& adduser admin lp \
|
||||||
&& adduser print lpadmin
|
&& adduser admin lpadmin
|
||||||
|
|
||||||
# disable sudo password checking
|
# disable sudo password checking
|
||||||
RUN echo 'print ALL=(ALL:ALL) ALL' >> /etc/sudoers
|
RUN echo 'admin ALL=(ALL:ALL) ALL' >> /etc/sudoers
|
||||||
|
|
||||||
# enable access to CUPS
|
# enable access to CUPS
|
||||||
RUN /usr/sbin/cupsd \
|
RUN /usr/sbin/cupsd \
|
||||||
@ -37,12 +52,18 @@ RUN /usr/sbin/cupsd \
|
|||||||
&& kill $(cat /var/run/cups/cupsd.pid) \
|
&& kill $(cat /var/run/cups/cupsd.pid) \
|
||||||
&& echo "ServerAlias *" >> /etc/cups/cupsd.conf
|
&& echo "ServerAlias *" >> /etc/cups/cupsd.conf
|
||||||
|
|
||||||
# volumes
|
# copy /etc/cups for skeleton usage
|
||||||
VOLUME ["/etc/cups/printers.conf"]
|
RUN cp -rp /etc/cups /etc/cups-skel
|
||||||
VOLUME ["/etc/cups/ppd"]
|
|
||||||
|
|
||||||
# ports
|
# entrypoint
|
||||||
EXPOSE 631
|
ADD docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||||
|
ENTRYPOINT [ "docker-entrypoint.sh" ]
|
||||||
|
|
||||||
# default command
|
# default command
|
||||||
CMD ["/usr/sbin/cupsd", "-f"]
|
CMD ["cupsd", "-f"]
|
||||||
|
|
||||||
|
# volumes
|
||||||
|
VOLUME ["/etc/cups"]
|
||||||
|
|
||||||
|
# ports
|
||||||
|
EXPOSE 631
|
24
README.md
24
README.md
@ -1,8 +1,26 @@
|
|||||||
# CUPS Docker Image
|
# CUPS Docker Image
|
||||||
|
|
||||||
## Start the container
|
## Architectures
|
||||||
|
|
||||||
|
- amd64
|
||||||
|
- arm32v7
|
||||||
|
- arm64v8
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Start the container
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
touch $(pwd)/printers.conf
|
docker run -d --restart always -p 631:631 -v $(pwd):/etc/cups ydkn/cups:latest
|
||||||
docker run -d --restart always -v $(pwd)/printers.conf:/etc/cups/printers.conf -v $(pwd)/ppd:/etc/cups/ppd ydkn/cups:latest
|
```
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
Login in to CUPS web interface on port 631 (e.g. https://localhost:631) and configure CUPS to your needs.
|
||||||
|
Default credentials: admin / admin
|
||||||
|
|
||||||
|
To change the admin password set the environment variable _ADMIN_PASSWORD_ to your password.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -d --restart always -p 631:631 -v $(pwd):/etc/cups -e ADMIN_PASSWORD=mySecretPassword ydkn/cups:latest
|
||||||
```
|
```
|
||||||
|
9
docker-entrypoint.sh
Executable file
9
docker-entrypoint.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
echo -e "${ADMIN_PASSWORD}\n${ADMIN_PASSWORD}" | passwd admin
|
||||||
|
|
||||||
|
if [ ! -f /etc/cups/printers.conf ]; then
|
||||||
|
cp -rpn /etc/cups-skel/* /etc/cups/
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
Loading…
x
Reference in New Issue
Block a user