From 1e8a22729a5237ef5189b666ca844b8902e5b860 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 8 Sep 2021 11:54:01 +0000 Subject: [PATCH] moving the installation directory from /var/www/html/codepot to /var/www/html in the docker file --- codepot/docker/Dockerfile.rocky84 | 3 +- codepot/docker/apache2-fg.sh | 52 +++++++++++++++++++++++++++++-- codepot/docker/build-rocky84.sh | 17 ++-------- codepot/docker/build-ubnt2004.sh | 14 +-------- 4 files changed, 56 insertions(+), 30 deletions(-) diff --git a/codepot/docker/Dockerfile.rocky84 b/codepot/docker/Dockerfile.rocky84 index d9701ddf..68da0692 100644 --- a/codepot/docker/Dockerfile.rocky84 +++ b/codepot/docker/Dockerfile.rocky84 @@ -8,12 +8,13 @@ RUN dnf install -y \ subversion subversion-perl \ httpd php php-mysqli php-gd php-pdo \ perl-Digest-SHA perl-Config-Simple \ - perl-DBD-MySQL perl-DBD-SQLite perl-LDAP \ + perl-DBD-MySQL perl-DBD-SQLite perl-LDAP perl-Mail-Sendmail \ mod_dav_svn mod_perl diffutils sqlite RUN dnf install -y php-devel subversion-devel perl-devel make COPY build-rocky84.sh /tmp +COPY codepot-0.4.0.tar.gz /tmp RUN /tmp/build-rocky84.sh && rm -rf /tmp/* COPY httpd-fg.sh /usr/sbin/ diff --git a/codepot/docker/apache2-fg.sh b/codepot/docker/apache2-fg.sh index 7c1711de..bbaf48dd 100755 --- a/codepot/docker/apache2-fg.sh +++ b/codepot/docker/apache2-fg.sh @@ -1,6 +1,52 @@ #!/bin/bash set -e +SERVICE_PORT="" +while getopts ":hp:-:" oc +do + case "${oc}" in + -) + case "${OPTARG}" in + port) + opt=${OPTARG} + SERVICE_PORT="${!OPTIND}" + OPTIND=$(($OPTIND + 1)) + ;; + port=*) + SERVICE_PORT=${OPTARG#*=} + opt=${OPTARG%=$val} + ;; + + *) + echo "Warning: unknown option - $OPTARG" + ;; + esac + ;; + + h) + echo "-----------------------------------------------------------" + echo "This container runs a http service on port 80." + echo "Use an external reverse proxy to enable https as it doesn't" + echo "enable the HTTP service." + echo "Extra options allowed when running the container: " + echo " -h print this help message" + echo " -p number specify the port number" + echo " -port number specify the port number" + echo "-----------------------------------------------------------" + ;; + p) + SERVICE_PORT=${OPTARG#*=} + opt=${OPTARG%=$val} + ;; + + *) + echo "Warning: unknown option - $OPTARG" + ;; + esac +done +echo "${SERVICE_PORT}" | grep -q -E '^[[:digit:]]+$' || SERVICE_PORT="80" + + # 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) @@ -37,7 +83,6 @@ for e in "${!APACHE_@}"; do fi done - [ ! -d /var/lib/codepot/attachments ] && mkdir -p /var/lib/codepot/attachments [ ! -d /var/lib/codepot/files ] && mkdir -p /var/lib/codepot/files [ ! -d /var/lib/codepot/issuefiles ] && mkdir -p /var/lib/codepot/issuefiles @@ -50,6 +95,7 @@ chown -R www-data:www-data /var/lib/codepot /var/cache/codepot /var/log/codepot [ ! -f /var/lib/codepot/codepot.ini ] && cp -pf /etc/codepot/codepot.ini /var/lib/codepot/codepot.ini +### TODO: this needs changes.. grep -F -q '' /etc/apache2/conf-enabled/codepot.conf || { cat <> /etc/apache2/conf-enabled/codepot.conf @@ -58,5 +104,7 @@ grep -F -q '' /etc/apache2/conf-enabled/codepot.conf || { EOF } +## TODO: change the port number according to SERVICE_PORT + #httpd server in the foreground -exec apache2 -DFOREGROUND "$@" +exec apache2 -DFOREGROUND diff --git a/codepot/docker/build-rocky84.sh b/codepot/docker/build-rocky84.sh index 9e1c8d26..f95a7e41 100755 --- a/codepot/docker/build-rocky84.sh +++ b/codepot/docker/build-rocky84.sh @@ -1,14 +1,15 @@ cd /tmp -svn co http://code.miflux.com/svn/codepot/trunk/codepot && \ +##svn co http://code.miflux.com/svn/codepot/trunk/codepot && \ +tar -zxvf codepot-0.4.0.tar.gz && mv -f codepot-0.4.0 codepot && \ touch -r * */* */*/* */*/*/* */*/*/*/* && \ cd codepot && \ ./configure \ --prefix=/usr \ --libdir=/usr/lib64 \ --sysconfdir=/etc \ - --with-wwwdir=/var/www/html/codepot \ + --with-wwwdir=/var/www/html \ --with-cfgdir=/etc/codepot \ --with-depotdir=/var/lib/codepot \ --with-logdir=/var/log/codepot \ @@ -26,18 +27,6 @@ mkdir -p /run/php-fpm && \ 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 - # mod_perl has dependency on perl-devel which i think is wrong. # so i can't get perl-devel removed. dnf remove -y php-dev subversion-devel make && \ diff --git a/codepot/docker/build-ubnt2004.sh b/codepot/docker/build-ubnt2004.sh index 062d2d75..586e1b9b 100755 --- a/codepot/docker/build-ubnt2004.sh +++ b/codepot/docker/build-ubnt2004.sh @@ -6,7 +6,7 @@ cd codepot && \ --prefix=/usr \ --libdir=/usr/lib64 \ --sysconfdir=/etc \ - --with-wwwdir=/var/www/html/codepot \ + --with-wwwdir=/var/www/html \ --with-cfgdir=/etc/codepot \ --with-depotdir=/var/lib/codepot \ --with-logdir=/var/log/codepot \ @@ -24,18 +24,6 @@ sed -ri -e 's|Digest::SHA1|Digest::SHA|g' /etc/codepot/perl/Codepot/AccessHandle cp -pf /etc/codepot/codepot.httpd /etc/apache2/conf-enabled/codepot.conf && \ echo "PerlSwitches -Mlib=/etc/codepot/perl" >> /etc/apache2/conf-enabled/perl.conf -cat < /var/www/html/index.html - - -Codepot - - - -

Access this page for codepot.

- - -EOF - apt remove --purge -y --allow-remove-essential php-dev libsvn-dev make libfdisk1 && \ apt autoremove --purge -y && rm -rf /var/lib/apt/lists/*