From a79bd1e178a509b5669e7324f92fa076fed07971 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 31 Aug 2021 16:13:29 +0000 Subject: [PATCH] adding dockerfile for rocky84 --- codepot/docker/Dockerfile.rocky84 | 6 +++ codepot/docker/Makefile | 7 ++++ codepot/docker/build-rocky84.sh | 70 +++++++++++++++++++++++++++++++ codepot/docker/httpd-fg.sh | 44 +++++++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 codepot/docker/Dockerfile.rocky84 create mode 100755 codepot/docker/build-rocky84.sh create mode 100755 codepot/docker/httpd-fg.sh diff --git a/codepot/docker/Dockerfile.rocky84 b/codepot/docker/Dockerfile.rocky84 new file mode 100644 index 00000000..e8733a13 --- /dev/null +++ b/codepot/docker/Dockerfile.rocky84 @@ -0,0 +1,6 @@ +FROM rockylinux/rockylinux:latest + +COPY build-rocky84.sh /tmp +RUN /tmp/build-rocky84.sh && rm -rf /tmp/* + +CMD ["/usr/sbin/httpd-fg.sh"] diff --git a/codepot/docker/Makefile b/codepot/docker/Makefile index f6f5b9c3..4e611a88 100644 --- a/codepot/docker/Makefile +++ b/codepot/docker/Makefile @@ -1,2 +1,9 @@ all: + @echo "Choose one of the following targets:" + @echo " rocky84 ubnt2004" + +ubnt2004: docker build -t codepot:ubnt20.04 -f Dockerfile.ubnt2004 . + +rocky84: + docker build -t codepot:rocky8.4 -f Dockerfile.rocky84 . diff --git a/codepot/docker/build-rocky84.sh b/codepot/docker/build-rocky84.sh new file mode 100755 index 00000000..8277cf2a --- /dev/null +++ b/codepot/docker/build-rocky84.sh @@ -0,0 +1,70 @@ +cd /tmp + +## epel-release for mod_perl +dnf install -y epel-release + +dnf install -y \ + subversion subversion-perl \ + mariadb-server mariadb httpd \ + php php-mysqli php-gd \ + perl-Digest-SHA \ + perl-DBD-MySQL perl-LDAP \ + mod_dav_svn mod_perl \ + php-devel subversion-devel perl-devel make + +dnf remove -y mariadb-gssapi-server mariadb-backup + +svn co http://code.miflux.com/svn/codepot/trunk/codepot && \ +touch -r * */* */*/* */*/*/* */*/*/*/* && \ +cd codepot && \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib64 \ + --sysconfdir=/etc \ + --with-wwwdir=/var/www/html/codepot \ + --with-cfgdir=/etc/codepot \ + --with-depotdir=/var/lib/codepot \ + --with-logdir=/var/log/codepot \ + --with-cachedir=/var/cache/codepot \ + --with-phpextdir=`php-config --extension-dir` \ +make && make install && \ +mkdir -p /var/lib/codepot/svnrepo /var/lib/codepot/files && \ +mkdir -p /var/cache/codepot /var/log/codepot && \ +chown -R apache:apache /var/lib/codepot /var/cache/codepot /var/log/codepot && \ +mysql_install_db --user=mysql --ldata=/var/lib/mysql && \ +(/usr/bin/mysqld_safe --datadir=/var/lib/mysql &) && sleep 5 && \ +mysql -e 'create database codepot' && \ +mysql -e 'source /etc/codepot/codepot.mysql' codepot && \ +mysql -e 'create user "codepot"@"localhost" identified by "codepot"' && \ +mysql -e 'grant all privileges on codepot.* to "codepot"@"localhost"' && \ +sed -ri -e 's|^database_hostname[[:space:]]*=[[:space:]]*""$|database_hostname = "localhost"|g' \ + -e 's|^database_username[[:space:]]*=[[:space:]]*""$|database_username = "codepot"|g' \ + -e 's|^database_password[[:space:]]*=[[:space:]]*""$|database_password = "codepot"|g' \ + -e 's|^database_name[[:space:]]*=[[:space:]]*""$|database_name = "codepot"|g' \ + -e 's|^database_driver[[:space:]]*=[[:space:]]*""$|database_driver = "mysqli"|g' /etc/codepot/codepot.ini && \ +sed -ri -e 's|Digest::SHA1|Digest::SHA|g' /usr/sbin/codepot-user && \ +sed -ri -e 's|Digest::SHA1|Digest::SHA|g' /etc/codepot/perl/Codepot/AccessHandler.pm && \ +mkdir -p /run/php-fpm && +install -m 0755 -D -t /usr/sbin docker/httpd-fg.sh && \ +cd .. && \ +cd .. && \ +\ +cp -pf /etc/codepot/codepot.httpd /etc/httpd/conf.d/codepot.conf && \ +echo "PerlSwitches -Mlib=/etc/codepot/perl" >> /etc/httpd/conf.d/perl.conf + +cat < /var/www/html/index.html + + +Codepot + + + +

Access this page for codepot.

+ + +EOF + +dnf remove -y php-dev subversion-devel perl-devel make && \ +dnf autoremove -y && rm -rf /var/lib/apt/lists/* + +rm -rf /root/.subversion diff --git a/codepot/docker/httpd-fg.sh b/codepot/docker/httpd-fg.sh new file mode 100755 index 00000000..8e90b364 --- /dev/null +++ b/codepot/docker/httpd-fg.sh @@ -0,0 +1,44 @@ +#!/bin/bash +set -e + +# Note: we don't just use "apache2ctl" here because it itself is just a shell-script wrapper around apache2 which provides extra functionality like "apache2ctl start" for launching apache2 in the background. +# (also, when run as "apache2ctl ", it does not use "exec", which leaves an undesirable resident shell process) + +: "${APACHE_CONFDIR:=/etc/httpd}" +: "${APACHE_ENVVARS:=$APACHE_CONFDIR/envvars}" +if test -f "$APACHE_ENVVARS"; then + . "$APACHE_ENVVARS" +fi + +# Apache gets grumpy about PID files pre-existing +: "${APACHE_RUN_DIR:=/var/run/httpd}" +: "${APACHE_PID_FILE:=$APACHE_RUN_DIR/httpd.pid}" +rm -f "$APACHE_PID_FILE" + +# create missing directories +# (especially APACHE_RUN_DIR, APACHE_LOCK_DIR, and APACHE_LOG_DIR) +for e in "${!APACHE_@}"; do + if [[ "$e" == *_DIR ]] && [[ "${!e}" == /* ]]; then + # handle "/var/lock" being a symlink to "/run/lock", but "/run/lock" not existing beforehand, so "/var/lock/something" fails to mkdir + # mkdir: cannot create directory '/var/lock': File exists + dir="${!e}" + while [ "$dir" != "$(dirname "$dir")" ]; do + dir="$(dirname "$dir")" + if [ -d "$dir" ]; then + break + fi + absDir="$(readlink -f "$dir" 2>/dev/null || :)" + if [ -n "$absDir" ]; then + mkdir -p "$absDir" + fi + done + + mkdir -p "${!e}" + fi +done + +# start the mysql service and run the httpd server in the foreground +/usr/bin/mysqld_safe --datadir='/var/lib/mysql' & +php-fpm +sleep 2 +exec httpd -DFOREGROUND "$@"