unrealircd- supernets unrealircd source & configuration |
git clone git://git.acid.vegas/unrealircd.git |
Log | Files | Refs | Archive |
Dockerfile (2669B)
1 # SuperNETS UnrealIRCd - Developed by acidvegas (https://github.com/supernets/unrealircd) 2 # unrealircd/Dockerfile 3 4 # Define the source and build directories 5 ENV SOURCE_DIR="/tmp/ircd" 6 ENV BUILD_DIR="/opt/ircd" 7 8 # Use debian-based image for consistency 9 FROM debian:bullseye-slim 10 11 # Install required packages 12 RUN apt-get update && apt-get install -y \ 13 build-essential \ 14 pkg-config \ 15 gdb \ 16 libssl-dev \ 17 libpcre2-dev \ 18 libargon2-0-dev \ 19 libsodium-dev \ 20 libc-ares-dev \ 21 libcurl4-openssl-dev \ 22 && rm -rf /var/lib/apt/lists/* 23 24 # Copy the .env file 25 COPY .env /tmp/.env 26 27 # Parse .env file and set environment variables 28 ENV LEAF_NAME=$(grep LEAF_NAME /tmp/.env | cut -d'"' -f2) 29 ENV LEAF_PORT=$(grep LEAF_PORT /tmp/.env | cut -d'"' -f2) 30 ENV REMOTE_INCLUDE_URL=$(grep REMOTE_INCLUDE_URL /tmp/.env | cut -d'"' -f2) 31 32 # Remove the temporary .env file after parsing 33 RUN rm /tmp/.env 34 35 # Copy source files 36 COPY ircd ${SOURCE_DIR} 37 38 # Enter the source directory 39 WORKDIR ${SOURCE_DIR} 40 41 # Build UnrealIRCd 42 RUN echo -e "\n" | ./Config -nointro && make && make install 43 44 # Switch to the build directory 45 WORKDIR ${BUILD_DIR} 46 47 # Nuke the source directory 48 RUN rm -rf ${SOURCE_DIR} 49 50 # Nuke the default configuration files 51 RUN find ${BUILD_DIR}/doc/conf/ -maxdepth 1 -type f ! -name 'unrealircd.link.conf' ! -name 'remote.motd' -exec rm -f {} + 52 RUN mv ${BUILD_DIR}/doc/conf/unrealircd.link.conf ${BUILD_DIR}/doc/conf/unrealircd.conf 53 54 # Replace the remote include URL placeholder 55 RUN sed -i "s|https://USERNAME:PASSWORD@hub.supernets.org:PORT|${REMOTE_INCLUDE_URL}|g" ${BUILD_DIR}/doc/conf/unrealircd.conf 56 57 # Replace the server name placeholder 58 RUN sed -i "s|example.supernets.org|${LEAF_NAME}.supernets.org|g" ${BUILD_DIR}/doc/conf/unrealircd.conf 59 60 # Replace the SID placeholder 61 # Generate a random SID 62 ENV SID=$(cat /dev/urandom | tr -dc '0-9' | fold -w 256 | head -n 1 | head --bytes 1)$(cat /dev/urandom | tr -dc 'A-Z0-9' | fold -w 2 | head -n 1) 63 RUN sed -i "s|XXX|${SID}|g" ${BUILD_DIR}/doc/conf/unrealircd.conf 64 65 # Copy over the assets 66 COPY assets/* ${BUILD_DIR}/assets/ 67 RUN mv ${BUILD_DIR}/assets/*.db ${BUILD_DIR}/data/ 68 RUN mv ${BUILD_DIR}/assets/tls.crt ${BUILD_DIR}/conf/tls.crt 69 RUN mv ${BUILD_DIR}/assets/tls.key ${BUILD_DIR}/conf/tls.key 70 71 # Create ircd user and group 72 RUN groupadd -r ircd && useradd -r -g ircd ircd 73 74 # Set permissions 75 RUN chown -R ircd:ircd ${BUILD_DIR} 76 77 # Expose standard IRC client ports 78 EXPOSE 6660-6669 7000 79 80 # Expose TLS client ports 81 EXPOSE 6697 9000 82 83 # Expose server-only port 84 EXPOSE ${LEAF_PORT} 85 86 # Switch to ircd user 87 USER ircd 88 89 # Set entrypoint 90 ENTRYPOINT ["/opt/unrealircd/bin/unrealircd", "start"]