Update: dockerize externally, update --colored flag

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
Václav Valíček 2022-08-09 06:41:41 +02:00
parent be404eb5e3
commit 27057beed4
Signed by: valicek
GPG Key ID: FF05BDCA0C73BB31
5 changed files with 4 additions and 41 deletions

View File

@ -1,39 +1,7 @@
# Debian base image # git bash openssh-server parallel vim cron npm nodejs logrotate
FROM registry.sw3.cz/valicek1/lxcbian-bullseye
VOLUME /data
# install dependencies
RUN apt-get update
RUN apt-get full-upgrade -y --no-install-recommends
RUN apt-get install -y --no-install-recommends \
git bash openssh-server parallel vim cron npm nodejs logrotate
RUN apt-get clean
# create executor user
RUN useradd --uid 10000 -ms /bin/bash executor
# install crontab, enable cron
ADD crontab /etc/cron.d/repo-cloner-executor
RUN bash -c "dpkg -l | grep cron"
RUN systemctl enable ssh cron
ADD dockerbin/* checker/* src/* /usr/local/bin/ ADD dockerbin/* checker/* src/* /usr/local/bin/
# remove tty autospawn from inittab
# disable motd
RUN echo > /etc/motd
# install tail logger
RUN npm i frontail -g
# enable frontail at startup
ADD startup-logcat /usr/local/bin
ADD logcat.service /etc/systemd/system
RUN systemctl enable logcat
# enable log dumping & rotation
ADD startup-logdump /usr/local/bin
ADD syslog.logrotate /etc/logrotate.d/syslog
ADD logdump.service /etc/systemd/system
RUN systemctl enable logdump
RUN ln -fs /usr/share/zoneinfo/Europe/Prague /etc/localtime RUN ln -fs /usr/share/zoneinfo/Europe/Prague /etc/localtime

View File

@ -1,5 +0,0 @@
# executor crontab
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAILTO=""
* * * * * executor /usr/local/bin/cron-command >> /home/executor/cron.log 2>&1
0 0 * * * executor mv /home/executor/cron.log /home/executor/cron.old

View File

@ -36,7 +36,7 @@ def parse_args():
parser.add_argument( parser.add_argument(
'--base-dir', help = 'path to directory containing whole cloner structure', required = True, '--base-dir', help = 'path to directory containing whole cloner structure', required = True,
default = None, type = str) default = None, type = str)
parser.add_argument('--colored', help = "enable colored log output even tty() is not detected") parser.add_argument('--colored', help = "enable colored log output even tty() is not detected", action = "store_true")
args = parser.parse_args() args = parser.parse_args()
base_dir = Path(args.base_dir) base_dir = Path(args.base_dir)

View File

@ -85,7 +85,7 @@ def main() -> int:
parser.add_argument("target", help = "path where to checkout") parser.add_argument("target", help = "path where to checkout")
parser.add_argument("--checkout", help = "checkout this reference, otherwise default HEAD will be left") parser.add_argument("--checkout", help = "checkout this reference, otherwise default HEAD will be left")
parser.add_argument('--debug', '-d', help = "enable debug output", action = 'store_true') parser.add_argument('--debug', '-d', help = "enable debug output", action = 'store_true')
parser.add_argument('--colored', help = "enable colored log output even tty() is not detected") parser.add_argument('--colored', help = "enable colored log output even tty() is not detected", action = "store_true")
args = parser.parse_args() args = parser.parse_args()
if args.debug: if args.debug:
log.info(f"Setting loglevel to debug") log.info(f"Setting loglevel to debug")

View File

@ -107,7 +107,7 @@ def main() -> int:
parser.add_argument('--base-dir', help = 'path to directory containing whole cloner structure', required = True, parser.add_argument('--base-dir', help = 'path to directory containing whole cloner structure', required = True,
default = None, type = str) default = None, type = str)
parser.add_argument('--debug', '-d', help = "enable debug output", action = 'store_true') parser.add_argument('--debug', '-d', help = "enable debug output", action = 'store_true')
parser.add_argument('--colored', help = "enable colored log output even tty() is not detected") parser.add_argument('--colored', help = "enable colored log output even tty() is not detected", action = "store_true")
args = parser.parse_args() args = parser.parse_args()
if args.debug: if args.debug:
log.setLevel(logging.DEBUG) log.setLevel(logging.DEBUG)