initial import
This commit is contained in:
commit
883eebe6fb
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/qemu-*-static
|
108
.gitlab-ci.yml
Normal file
108
.gitlab-ci.yml
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
image: docker:stable
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- release
|
||||||
|
|
||||||
|
variables:
|
||||||
|
QEMU_VERSION: v4.0.0-5
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- mkdir -p /root/.docker || true
|
||||||
|
- echo '{"experimental":"enabled"}' > /root/.docker/config.json
|
||||||
|
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
|
||||||
|
|
||||||
|
build-amd64:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_VERSION}/qemu-x86_64-static -O qemu-x86_64-static
|
||||||
|
- chmod 554 qemu-*-static
|
||||||
|
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
|
- docker build --build-arg ARCH=amd64 -t ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-amd64 .
|
||||||
|
- docker push ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-amd64
|
||||||
|
|
||||||
|
build-arm32v6:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_VERSION}/qemu-arm-static -O qemu-arm-static
|
||||||
|
- chmod 554 qemu-*-static
|
||||||
|
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
|
- docker build --build-arg ARCH=arm32v6 -t ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v6 .
|
||||||
|
- docker push ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v6
|
||||||
|
|
||||||
|
build-arm32v7:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_VERSION}/qemu-arm-static -O qemu-arm-static
|
||||||
|
- chmod 554 qemu-*-static
|
||||||
|
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
|
- docker build --build-arg ARCH=arm32v7 -t ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v7 .
|
||||||
|
- docker push ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v7
|
||||||
|
|
||||||
|
build-arm64v8:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_VERSION}/qemu-aarch64-static -O qemu-aarch64-static
|
||||||
|
- chmod 554 qemu-*-static
|
||||||
|
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
|
- docker build --build-arg ARCH=arm64v8 -t ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm64v8 .
|
||||||
|
- docker push ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm64v8
|
||||||
|
|
||||||
|
release:
|
||||||
|
stage: release
|
||||||
|
script:
|
||||||
|
- docker pull ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-amd64
|
||||||
|
- docker tag ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-amd64 ${CI_REGISTRY_IMAGE}:latest-amd64
|
||||||
|
- docker push ${CI_REGISTRY_IMAGE}:latest-amd64
|
||||||
|
- docker pull ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v6
|
||||||
|
- docker tag ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v6 ${CI_REGISTRY_IMAGE}:latest-arm32v6
|
||||||
|
- docker push ${CI_REGISTRY_IMAGE}:latest-arm32v6
|
||||||
|
- docker pull ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v7
|
||||||
|
- docker tag ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v7 ${CI_REGISTRY_IMAGE}:latest-arm32v7
|
||||||
|
- docker push ${CI_REGISTRY_IMAGE}:latest-arm32v7
|
||||||
|
- docker pull ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm64v8
|
||||||
|
- docker tag ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm64v8 ${CI_REGISTRY_IMAGE}:latest-arm64v8
|
||||||
|
- docker push ${CI_REGISTRY_IMAGE}:latest-arm64v8
|
||||||
|
- docker manifest create ${CI_REGISTRY_IMAGE}:latest ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-amd64 ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v6 ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v7 ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm64v8
|
||||||
|
- docker manifest annotate --os linux --arch amd64 ${CI_REGISTRY_IMAGE}:latest ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-amd64
|
||||||
|
- docker manifest annotate --os linux --arch arm --variant v6 ${CI_REGISTRY_IMAGE}:latest ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v6
|
||||||
|
- docker manifest annotate --os linux --arch arm --variant v7 ${CI_REGISTRY_IMAGE}:latest ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v7
|
||||||
|
- docker manifest annotate --os linux --arch arm64 --variant v8 ${CI_REGISTRY_IMAGE}:latest ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm64v8
|
||||||
|
- docker manifest push ${CI_REGISTRY_IMAGE}:latest
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- tags
|
||||||
|
- schedules
|
||||||
|
|
||||||
|
dockerhub:
|
||||||
|
stage: release
|
||||||
|
before_script:
|
||||||
|
- mkdir -p /root/.docker || true
|
||||||
|
- echo '{"experimental":"enabled"}' > /root/.docker/config.json
|
||||||
|
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
|
||||||
|
- docker login -u ${DOCKERHUB_USER} -p ${DOCKERHUB_PASSWORD} ${DOCKERHUB_REGISTRY}
|
||||||
|
script:
|
||||||
|
- docker pull ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-amd64
|
||||||
|
- docker tag ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-amd64 ${DOCKERHUB_IMAGE}:latest-amd64
|
||||||
|
- docker push ${DOCKERHUB_IMAGE}:latest-amd64
|
||||||
|
- docker pull ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v6
|
||||||
|
- docker tag ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v6 ${DOCKERHUB_IMAGE}:latest-arm32v6
|
||||||
|
- docker push ${DOCKERHUB_IMAGE}:latest-arm32v6
|
||||||
|
- docker pull ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v7
|
||||||
|
- docker tag ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm32v7 ${DOCKERHUB_IMAGE}:latest-arm32v7
|
||||||
|
- docker push ${DOCKERHUB_IMAGE}:latest-arm32v7
|
||||||
|
- docker pull ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm64v8
|
||||||
|
- docker tag ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-arm64v8 ${DOCKERHUB_IMAGE}:latest-arm64v8
|
||||||
|
- docker push ${DOCKERHUB_IMAGE}:latest-arm64v8
|
||||||
|
- docker manifest create ${DOCKERHUB_IMAGE}:latest ${DOCKERHUB_IMAGE}:latest-amd64 ${DOCKERHUB_IMAGE}:latest-arm32v6 ${DOCKERHUB_IMAGE}:latest-arm32v7 ${DOCKERHUB_IMAGE}:latest-arm64v8
|
||||||
|
- docker manifest annotate --os linux --arch amd64 ${DOCKERHUB_IMAGE}:latest ${DOCKERHUB_IMAGE}:latest-amd64
|
||||||
|
- docker manifest annotate --os linux --arch arm --variant v6 ${DOCKERHUB_IMAGE}:latest ${DOCKERHUB_IMAGE}:latest-arm32v6
|
||||||
|
- docker manifest annotate --os linux --arch arm --variant v7 ${DOCKERHUB_IMAGE}:latest ${DOCKERHUB_IMAGE}:latest-arm32v7
|
||||||
|
- docker manifest annotate --os linux --arch arm64 --variant v8 ${DOCKERHUB_IMAGE}:latest ${DOCKERHUB_IMAGE}:latest-arm64v8
|
||||||
|
- docker manifest push ${DOCKERHUB_IMAGE}:latest
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- tags
|
||||||
|
- schedules
|
53
Dockerfile
Normal file
53
Dockerfile
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# Base image
|
||||||
|
ARG ARCH=amd64
|
||||||
|
FROM $ARCH/debian:buster-slim
|
||||||
|
|
||||||
|
# Prepare multi arch build
|
||||||
|
COPY qemu-* /usr/bin/
|
||||||
|
|
||||||
|
# Maintainer
|
||||||
|
MAINTAINER Florian Schwab <me@ydkn.io>
|
||||||
|
|
||||||
|
# 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 \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# add print user
|
||||||
|
RUN adduser --home /home/print --shell /bin/bash --gecos "print" --disabled-password print \
|
||||||
|
&& adduser print sudo \
|
||||||
|
&& adduser print lp \
|
||||||
|
&& adduser print lpadmin
|
||||||
|
|
||||||
|
# disable sudo password checking
|
||||||
|
RUN echo 'print 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)
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
RUN rm -f /usr/bin/qemu-*-static /app/qemu-*-static
|
||||||
|
|
||||||
|
# volumes
|
||||||
|
VOLUME ["/etc/cups/printers.conf"]
|
||||||
|
VOLUME ["/etc/cups/ppd"]
|
||||||
|
|
||||||
|
# ports
|
||||||
|
EXPOSE 631
|
||||||
|
|
||||||
|
# default command
|
||||||
|
CMD ["/usr/sbin/cupsd", "-f"]
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019 Florian Schwab
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
8
README.md
Normal file
8
README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# CUPS Docker Image
|
||||||
|
|
||||||
|
## Start the container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
touch $(pwd)/printers.conf
|
||||||
|
docker run -d --restart always -v $(pwd)/printers.conf:/etc/cups/printers.conf -v $(pwd)/ppd:/etc/cups/ppd ydkn/cups:latest
|
||||||
|
```
|
3
qemu-dummy-static
Executable file
3
qemu-dummy-static
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "Dummy QEMU wrapper to allow builds without specifing an architecture."
|
Loading…
x
Reference in New Issue
Block a user