Commit b338dcf9 authored by Benjamin Rokseth's avatar Benjamin Rokseth
Browse files

Create docker image and compose file

parent 3e71c0ae
FROM golang:1.13 AS builder
MAINTAINER opl@deichman.no
WORKDIR /app
COPY kohaprinter.* .
RUN CGO_ENABLED=0 go build -o kohaprinter
FROM debian:testing
# Install Packages (basic tools, cups, basic drivers, HP drivers)
RUN apt-get update &&\
dpkg --add-architecture i386 &&\
apt-get install -y \
sudo whois cups cups-client cups-bsd cups-filters foomatic-db-compressed-ppds printer-driver-all openprinting-ppds \
hpijs-ppds hp-ppd hplip smbclient &&\
apt-get clean
# Add user and disable sudo password checking
RUN useradd --groups=sudo,lp,lpadmin --create-home --home-dir=/home/print --shell=/bin/bash --password=$(mkpasswd print) print &&\
sed -i '/%sudo[[:space:]]/ s/ALL[[:space:]]*$/NOPASSWD:ALL/' /etc/sudoers
# Kohaprinter backend and extra cups drivers
COPY --from=builder /app/kohaprinter /usr/lib/cups/backend/
COPY drivers /
COPY config/ /etc/cups/
RUN chown .lp /etc/cups/ppd/*.ppd
# RUN dpkg -i --force-architecture ql720nwlpr-1.0.1-1.i386.deb
# dpkg -i --force-architecture ql720nwcupswrapper-1.0.1-1.i386.deb
# cp /usr/lib/cups/filter/brlpdwrapper* /usr/lib64/cups/filter
# cp /usr/lib/cups/filter/brlpdwrapper* /usr/lib64/cups/filter
# Extra ppds
#COPY ./ppd/* /usr/share/cups/model/
# Configure the service's to be reachable
# RUN /usr/sbin/cupsd &&\
# while [ ! -f /var/run/cups/cupsd.pid ]; do sleep 1; done &&\
# cupsctl --remote-admin --share-printers &&\
# kill $(cat /var/run/cups/cupsd.pid)
RUN dpkg -i --force-all --force-architecture /ql720nwpdrv-3.1.5-0.i386.deb && apt-get clean &&\
rm -rf /var/lib/apt/lists/*
COPY startCups.sh /
CMD ["/startCups.sh"]
\ No newline at end of file
version: "3.5"
networks:
kohaprinter:
driver: bridge
volumes:
rqlite_data: {}
services:
cups:
image: cups:latest
container_name: cups
build:
context: .
ports:
- "631:631"
volumes:
- /var/run/dbus:/var/run/dbus
- ./config:/etc/cups
networks:
- kohaprinter
athena:
container_name: athenapdf
image: arachnysdocker/athenapdf-service:latest
networks:
- kohaprinter
ports:
- "8089:8080"
volumes:
- "rqlite_data:/data"
logging:
driver: "json-file"
options:
max-size: "1m"
max-file: "2"
#!/usr/bin/env bash
pid=0
# SIGUSR1-handler
my_handler() {
echo "my_handler"
}
# SIGTERM-handler
term_handler() {
if [ $pid -ne 0 ]; then
kill -SIGTERM "$pid"
wait "$pid"
fi
exit 143; # 128 + 15 -- SIGTERM
}
# setup handlers
trap 'kill ${!}; my_handler' SIGUSR1
trap 'kill ${!}; term_handler' SIGTERM
trap 'kill ${!}; term_handler' SIGINT
# run application
/usr/sbin/cupsd -f &
pid="$!"
# wait forever
while true
do
tail -f /dev/null & wait ${!}
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment