From 72b6f05c8d0aa6a24522ce3af72c2a3c59d49246 Mon Sep 17 00:00:00 2001 From: meliurwen Date: Tue, 21 Dec 2021 23:46:53 +0100 Subject: [PATCH] Fully working initial release --- .env.example | 7 ++++++ .gitignore | 1 + docker-compose.yml | 20 +++++++++++++++++ solanum/Dockerfile | 50 +++++++++++++++++++++++++++++++++++++++++++ solanum/root/start.sh | 20 +++++++++++++++++ 5 files changed, 98 insertions(+) create mode 100644 .env.example create mode 100644 .gitignore create mode 100644 docker-compose.yml create mode 100644 solanum/Dockerfile create mode 100755 solanum/root/start.sh diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..ec1df3a --- /dev/null +++ b/.env.example @@ -0,0 +1,7 @@ +# Global Settings +TZ=Etc/UTC +LOCAL_STACK_DIR=/srv/docker/volumes/ircd + +# solanum (optional) +SO_CONTAINER_NAME= +SO_RESTART= diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..03bd412 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.env diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2b12b73 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: "3" + +services: + + solanum: + build: + context: solanum/ + container_name: ${SO_CONTAINER_NAME:-ircd-solanum} + restart: ${SO_RESTART:-unless-stopped} + volumes: + - ${LOCAL_STACK_DIR}/solanum/etc:/srv/config + - ${LOCAL_STACK_DIR}/solanum/certs:/certs + - ${LOCAL_STACK_DIR}/solanum/logs:/srv/logs + ports: + - 5000:5000 + - 6665-6669:6665-6669 + - 6697:6697 + - 9999:9999 + environment: + - TZ=${TZ} diff --git a/solanum/Dockerfile b/solanum/Dockerfile new file mode 100644 index 0000000..2092555 --- /dev/null +++ b/solanum/Dockerfile @@ -0,0 +1,50 @@ +FROM alpine:latest AS builder + +LABEL maintainer="Meliurwen " + +RUN apk --update add git + +RUN git clone --depth 1 https://github.com/solanum-ircd/solanum.git /solanum + +WORKDIR /solanum + +RUN apk add \ + sqlite-dev \ + automake \ + autoconf \ + libtool +RUN ./autogen.sh + +RUN apk add \ + gcc \ + g++ \ + bison \ + flex \ + make \ + mbedtls-dev +RUN ./configure \ + --prefix=/srv/ircd \ + --enable-mbedtls + +RUN apk add \ + util-linux +RUN ./configure --prefix=/srv/ircd --enable-mbedtls && \ + make && \ + make install + + +FROM alpine:latest + +RUN apk add --no-cache \ + mbedtls \ + libltdl \ + sqlite-libs \ + && adduser -D ircd + +COPY --from=builder --chown=ircd /srv/ircd /srv/ircd + +COPY root/ / + +EXPOSE 5000 6665-6669 6697 9999 + +ENTRYPOINT ["/start.sh"] diff --git a/solanum/root/start.sh b/solanum/root/start.sh new file mode 100755 index 0000000..d345c6c --- /dev/null +++ b/solanum/root/start.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +mkdir -p /srv/config /srv/logs + +chown ircd:ircd -R /srv/config /srv/logs + +if [ ! -e /srv/config/ircd.conf ]; then + echo "Configuration file not found. Generating it..." + cp /srv/ircd/etc/ircd.conf.example /srv/config/ircd.conf +fi + +if [ ! -e /srv/config/ircd.motd ]; then + echo "MOTD file not found. Generating it..." + cp /srv/ircd/etc/ircd.motd /srv/config/ircd.motd +fi + +su ircd -c "/srv/ircd/bin/solanum \ + -configfile /srv/config/ircd.conf \ + -logfile /srv/logs/ircd.logs \ + -foreground"