moving the installation directory from /var/www/html/codepot to /var/www/html in the docker file

This commit is contained in:
hyung-hwan 2021-09-08 11:54:01 +00:00
parent 893b4a4159
commit 1e8a22729a
4 changed files with 56 additions and 30 deletions

View File

@ -8,12 +8,13 @@ RUN dnf install -y \
subversion subversion-perl \ subversion subversion-perl \
httpd php php-mysqli php-gd php-pdo \ httpd php php-mysqli php-gd php-pdo \
perl-Digest-SHA perl-Config-Simple \ 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 mod_dav_svn mod_perl diffutils sqlite
RUN dnf install -y php-devel subversion-devel perl-devel make RUN dnf install -y php-devel subversion-devel perl-devel make
COPY build-rocky84.sh /tmp COPY build-rocky84.sh /tmp
COPY codepot-0.4.0.tar.gz /tmp
RUN /tmp/build-rocky84.sh && rm -rf /tmp/* RUN /tmp/build-rocky84.sh && rm -rf /tmp/*
COPY httpd-fg.sh /usr/sbin/ COPY httpd-fg.sh /usr/sbin/

View File

@ -1,6 +1,52 @@
#!/bin/bash #!/bin/bash
set -e 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. # 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 <apache args>", it does not use "exec", which leaves an undesirable resident shell process) # (also, when run as "apache2ctl <apache args>", it does not use "exec", which leaves an undesirable resident shell process)
@ -37,7 +83,6 @@ for e in "${!APACHE_@}"; do
fi fi
done done
[ ! -d /var/lib/codepot/attachments ] && mkdir -p /var/lib/codepot/attachments [ ! -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/files ] && mkdir -p /var/lib/codepot/files
[ ! -d /var/lib/codepot/issuefiles ] && mkdir -p /var/lib/codepot/issuefiles [ ! -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 [ ! -f /var/lib/codepot/codepot.ini ] && cp -pf /etc/codepot/codepot.ini /var/lib/codepot/codepot.ini
### TODO: this needs changes..
grep -F -q '<Location "/codepot">' /etc/apache2/conf-enabled/codepot.conf || { grep -F -q '<Location "/codepot">' /etc/apache2/conf-enabled/codepot.conf || {
cat <<EOF >> /etc/apache2/conf-enabled/codepot.conf cat <<EOF >> /etc/apache2/conf-enabled/codepot.conf
<Location "/codepot"> <Location "/codepot">
@ -58,5 +104,7 @@ grep -F -q '<Location "/codepot">' /etc/apache2/conf-enabled/codepot.conf || {
EOF EOF
} }
## TODO: change the port number according to SERVICE_PORT
#httpd server in the foreground #httpd server in the foreground
exec apache2 -DFOREGROUND "$@" exec apache2 -DFOREGROUND

View File

@ -1,14 +1,15 @@
cd /tmp 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 * */* */*/* */*/*/* */*/*/*/* && \ touch -r * */* */*/* */*/*/* */*/*/*/* && \
cd codepot && \ cd codepot && \
./configure \ ./configure \
--prefix=/usr \ --prefix=/usr \
--libdir=/usr/lib64 \ --libdir=/usr/lib64 \
--sysconfdir=/etc \ --sysconfdir=/etc \
--with-wwwdir=/var/www/html/codepot \ --with-wwwdir=/var/www/html \
--with-cfgdir=/etc/codepot \ --with-cfgdir=/etc/codepot \
--with-depotdir=/var/lib/codepot \ --with-depotdir=/var/lib/codepot \
--with-logdir=/var/log/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 && \ cp -pf /etc/codepot/codepot.httpd /etc/httpd/conf.d/codepot.conf && \
echo "PerlSwitches -Mlib=/etc/codepot/perl" >> /etc/httpd/conf.d/perl.conf echo "PerlSwitches -Mlib=/etc/codepot/perl" >> /etc/httpd/conf.d/perl.conf
cat <<EOF > /var/www/html/index.html
<html>
<head>
<title>Codepot</title>
<meta http-equiv="refresh" content="0;URL='/codepot'" />
</head>
<body>
<p>Access <a href="/codepot">this page</a> for codepot.</p>
</body>
</html>
EOF
# mod_perl has dependency on perl-devel which i think is wrong. # mod_perl has dependency on perl-devel which i think is wrong.
# so i can't get perl-devel removed. # so i can't get perl-devel removed.
dnf remove -y php-dev subversion-devel make && \ dnf remove -y php-dev subversion-devel make && \

View File

@ -6,7 +6,7 @@ cd codepot && \
--prefix=/usr \ --prefix=/usr \
--libdir=/usr/lib64 \ --libdir=/usr/lib64 \
--sysconfdir=/etc \ --sysconfdir=/etc \
--with-wwwdir=/var/www/html/codepot \ --with-wwwdir=/var/www/html \
--with-cfgdir=/etc/codepot \ --with-cfgdir=/etc/codepot \
--with-depotdir=/var/lib/codepot \ --with-depotdir=/var/lib/codepot \
--with-logdir=/var/log/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 && \ cp -pf /etc/codepot/codepot.httpd /etc/apache2/conf-enabled/codepot.conf && \
echo "PerlSwitches -Mlib=/etc/codepot/perl" >> /etc/apache2/conf-enabled/perl.conf echo "PerlSwitches -Mlib=/etc/codepot/perl" >> /etc/apache2/conf-enabled/perl.conf
cat <<EOF > /var/www/html/index.html
<html>
<head>
<title>Codepot</title>
<meta http-equiv="refresh" content="0;URL='/codepot'" />
</head>
<body>
<p>Access <a href="/codepot">this page</a> for codepot.</p>
</body>
</html>
EOF
apt remove --purge -y --allow-remove-essential php-dev libsvn-dev make libfdisk1 && \ apt remove --purge -y --allow-remove-essential php-dev libsvn-dev make libfdisk1 && \
apt autoremove --purge -y && rm -rf /var/lib/apt/lists/* apt autoremove --purge -y && rm -rf /var/lib/apt/lists/*