adding dockerfile for rocky84

This commit is contained in:
hyung-hwan 2021-08-31 16:13:29 +00:00
parent 0dc60ea717
commit a79bd1e178
4 changed files with 127 additions and 0 deletions

View File

@ -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"]

View File

@ -1,2 +1,9 @@
all: all:
@echo "Choose one of the following targets:"
@echo " rocky84 ubnt2004"
ubnt2004:
docker build -t codepot:ubnt20.04 -f Dockerfile.ubnt2004 . docker build -t codepot:ubnt20.04 -f Dockerfile.ubnt2004 .
rocky84:
docker build -t codepot:rocky8.4 -f Dockerfile.rocky84 .

70
codepot/docker/build-rocky84.sh Executable file
View File

@ -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 <<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
dnf remove -y php-dev subversion-devel perl-devel make && \
dnf autoremove -y && rm -rf /var/lib/apt/lists/*
rm -rf /root/.subversion

44
codepot/docker/httpd-fg.sh Executable file
View File

@ -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 <apache args>", 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 "$@"