From 7cbecadb86220ada4213828aa15b892d13a4014f Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 25 Jul 2019 17:06:05 +1000 Subject: [PATCH] Initial Revision --- .gitlab-ci.yml | 21 +++++++++++++ .gitlab-docker-armv7l.yml | 16 ++++++++++ .gitlab-docker-x86_64.yml | 17 ++++++++++ Dockerfile | 66 +++++++++++++++++++++++++++++++++++++++ init | 24 ++++++++++++++ 5 files changed, 144 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 .gitlab-docker-armv7l.yml create mode 100644 .gitlab-docker-x86_64.yml create mode 100644 Dockerfile create mode 100755 init diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..f96bdfd --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,21 @@ +image: docker:latest + +stages: +- build + +variables: + VERSION: 3.17c-${ARCH} + CACHETAG: build-${ARCH} + DOCKER_HOST: tcp://docker:2375 + +services: +- docker:dind + +before_script: +- docker info +- docker version +- echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin +- ls -alR . + +include: .gitlab-docker-x86_64.yml +include: .gitlab-docker-armv7l.yml diff --git a/.gitlab-docker-armv7l.yml b/.gitlab-docker-armv7l.yml new file mode 100644 index 0000000..4f823cb --- /dev/null +++ b/.gitlab-docker-armv7l.yml @@ -0,0 +1,16 @@ +armv7l:build: + variables: + ARCH: armv7l + stage: build + image: docker:latest + script: + - if [ -f init ]; then chmod 500 init; fi + - ([ -z "$REFRESH" ] && docker pull ${CI_REGISTRY_IMAGE}:${CACHETAG}) || echo "true" + - docker build --cache-from ${CI_REGISTRY_IMAGE}:${CACHETAG} -t ${CI_REGISTRY_IMAGE}:${VERSION} -t ${CI_REGISTRY_IMAGE}:${CACHETAG} . + - docker push ${CI_REGISTRY_IMAGE}:${VERSION} + - docker push ${CI_REGISTRY_IMAGE}:${CACHETAG} + tags: + - docker + - armv7l + only: + - master diff --git a/.gitlab-docker-x86_64.yml b/.gitlab-docker-x86_64.yml new file mode 100644 index 0000000..67d1cf4 --- /dev/null +++ b/.gitlab-docker-x86_64.yml @@ -0,0 +1,17 @@ +x86_64:build: + variables: + ARCH: x86_64 + stage: build + image: docker:latest + script: + - if [ -f init ]; then chmod 500 init; fi + - ([ -z "$REFRESH" ] && docker pull ${CI_REGISTRY_IMAGE}:${CACHETAG}) || echo "true" + - docker build --cache-from ${CI_REGISTRY_IMAGE}:${CACHETAG} -t ${CI_REGISTRY_IMAGE}:${VERSION} -t ${CI_REGISTRY_IMAGE}:${CACHETAG} . + - docker push ${CI_REGISTRY_IMAGE}:${VERSION} + - docker push ${CI_REGISTRY_IMAGE}:${CACHETAG} + tags: + - docker + - x86_64 + only: + - master + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9d3b0ac --- /dev/null +++ b/Dockerfile @@ -0,0 +1,66 @@ +# NAME leenooks/sbbs +# VERSION 3.17c + +FROM debian:stretch-slim + +# Base utilities +RUN apt-get update \ + && apt-get install -yqq curl procps less zip unzip arj unrar-free lhasa arc zoo logrotate libmozjs185-1.0 cron \ + && apt-get -y autoremove \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Add in Leenooks' apt repository +RUN curl -s http://apt.leenooks.net/setup.sh | sh + +# Add ZeroTier +RUN echo "deb http://download.zerotier.com/debian/stretch stretch main" > /etc/apt/sources.list.d/zerotier.list + +# Leenooks Utils +RUN apt-get update \ + && apt-get install -yqq --allow-unauthenticated makenl zerotier-one \ + && apt-get -y autoremove \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Other Utilities +RUN echo "deb http://ftp.au.debian.org/debian/ stretch contrib" > /etc/apt/sources.list.d/contrib.list +RUN apt-get update \ + && apt-get install -yqq dosemu \ + && apt-get -y autoremove \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Build SBBS +RUN apt-get update \ + && apt-get install -yqq build-essential libnspr4-dev libncurses5-dev libmozjs185-dev cvs wget pkgconf \ + && mkdir /opt/sbbs && cd /tmp \ + && wget http://cvs.synchro.net/cgi-bin/viewcvs.cgi/*checkout*/install/GNUmakefile \ + && make RELEASE=1 USE_DOSEMU=1 NO_X=1 JSINCLUDE=/usr/include/js JSLIB=mozjs185 SBBSDIR=/opt/sbbs install \ + && rm -rf /opt/sbbs/3rdp /opt/sbbs/src \ + && mv /opt/sbbs/ctrl /opt/sbbs/ctrl.orig \ + && mkdir /opt/sbbs/nodes.orig && mv /opt/sbbs/node[1-4] /opt/sbbs/nodes.orig \ + && ln -sf nodes/node1 /opt/sbbs/ \ + && ln -sf nodes/node2 /opt/sbbs/ \ + && ln -sf nodes/node3 /opt/sbbs/ \ + && ln -sf nodes/node4 /opt/sbbs/ \ + && find /opt/sbbs -name CVS -type d -exec rm -rf {} + \ + && apt-get -y purge build-essential libnspr4-dev libncurses5-dev libmozjs185-dev cvs wget pkgconf \ + && apt-get -y autoremove \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +WORKDIR /opt/sbbs +ENV SBBSCTRL=/opt/sbbs/ctrl +ENV SBBSEXEC=/opt/sbbs/exec +ENV PATH=$PATH:${SBBSEXEC} + +COPY init /sbin/init +ENTRYPOINT [ "/sbin/init" ] +CMD ["sbbs"] + +VOLUME [ "/var/lib/zerotier-one" ] +VOLUME [ "/opt/sbbs/data","/opt/sbbs/ctrl","/opt/sbbs/nodes","/opt/sbbs/fido" ] + +# Set the default timezone for the container +RUN ln -sf /usr/share/zoneinfo/Australia/Melbourne /etc/localtime diff --git a/init b/init new file mode 100755 index 0000000..9d92dc3 --- /dev/null +++ b/init @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e +NAME="Synchronet BBS" + +export PATH=$PATH:${SBBSEXEC} + +if [ ! -e "${SBBSCTRL}/sbbs.ini" ]; then + echo "* Installing SBBS ctrl files into ${SBBSCTRL}" + cp -a ${SBBSCTRL}.orig/* ${SBBSCTRL} +fi + +if [ ! -d "${SBBSCTRL}/../nodes/node1" ]; then + echo "* Installing SBBS nodes files into ${SBBSCTRL}/../nodes" + cp -Ra ${SBBSCTRL}/../nodes.orig/* ${SBBSCTRL}/../nodes/ +fi + +if [ -x /usr/sbin/zerotier-one -a -n "${ENABLE_ZT}" ]; then + echo "* Starting ZeroTier" + mkdir /dev/net && mknod /dev/net/tun -m 666 c 10 200 + /usr/sbin/zerotier-one -d +fi + +exec "$@"