diff --git a/codepot/docker/Dockerfile.rocky b/codepot/docker/Dockerfile.rocky index df7a5d9d..cad2e8a4 100644 --- a/codepot/docker/Dockerfile.rocky +++ b/codepot/docker/Dockerfile.rocky @@ -30,6 +30,7 @@ RUN sed -ri -e 's|^database_hostname[[:space:]]*=[[:space:]]*"localhost"$|databa -e 's|^database_driver[[:space:]]*=[[:space:]]*""$|database_driver = "sqlite"|g' \ -e 's|^database_use_pdo[[:space:]]*=[[:space:]]*"no"$|database_use_pdo = "yes"|g' ${VROOT}/etc/codepot/codepot.ini +COPY httpd-fg.sh ${VROOT}/usr/sbin/ RUN tar -C ${VROOT} -zcvf /tmp/codepot-root.tar.gz . ### ------------------------------------------------------------------------------- @@ -38,27 +39,26 @@ FROM rockylinux/rockylinux:latest ARG VROOT -## epel-release for mod_perl -RUN dnf install -y epel-release - -# for mysql access, include php-mysqli and perl-DBD-MYSQL -RUN dnf install -y --enablerepo=powertools \ - subversion subversion-perl \ - httpd php php-gd php-pdo php-ldap \ - perl-Digest-SHA perl-Config-Simple \ - perl-DBD-SQLite perl-LDAP perl-Mail-Sendmail perl-Switch \ - mod_dav_svn mod_perl diffutils sqlite - COPY --from=installer /tmp/codepot-root.tar.gz /tmp -COPY httpd-fg.sh /usr/sbin/ +##COPY httpd-fg.sh /usr/sbin/ +## epel-release for mod_perl +## for mysql access, include php-mysqli and perl-DBD-MYSQL RUN \ + dnf install -y epel-release && \ + dnf install -y --enablerepo=powertools \ + subversion subversion-perl \ + httpd php php-gd php-pdo php-ldap \ + perl-Digest-SHA perl-Config-Simple \ + perl-DBD-SQLite perl-LDAP perl-Mail-Sendmail perl-Switch \ + mod_dav_svn mod_perl diffutils sqlite && \ rm -rf /var/www/html && \ mkdir -p /run/php-fpm && \ - tar -C / -zxvf /tmp/codepot-root.tar.gz && \ + tar -C / -zxvf /tmp/codepot-root.tar.gz && \ cp -pf /etc/codepot/codepot.httpd /etc/httpd/conf.d/codepot.conf && \ echo "PerlSwitches -Mlib=/etc/codepot/perl" >> /etc/httpd/conf.d/perl.conf && \ - sed -ri -e 's|^max_execution_time[[:space:]]*=.*$|max_execution_time = 120|g' /etc/php.ini + sed -ri -e 's|^max_execution_time[[:space:]]*=.*$|max_execution_time = 120|g' /etc/php.ini && \ + rm -rf /tmp/* ##CMD ["/usr/sbin/httpd-fg.sh"] ENTRYPOINT ["/usr/sbin/httpd-fg.sh"] diff --git a/codepot/docker/Dockerfile.ubnt2004 b/codepot/docker/Dockerfile.ubnt similarity index 81% rename from codepot/docker/Dockerfile.ubnt2004 rename to codepot/docker/Dockerfile.ubnt index 4f1c4b4f..e671184c 100644 --- a/codepot/docker/Dockerfile.ubnt2004 +++ b/codepot/docker/Dockerfile.ubnt @@ -33,6 +33,7 @@ RUN sed -ri -e 's|^database_hostname[[:space:]]*=[[:space:]]*"localhost"$|databa -e 's|^database_driver[[:space:]]*=[[:space:]]*""$|database_driver = "sqlite"|g' \ -e 's|^database_use_pdo[[:space:]]*=[[:space:]]*"no"$|database_use_pdo = "yes"|g' ${VROOT}/etc/codepot/codepot.ini +COPY apache2-fg.sh ${VROOT}/usr/sbin/ RUN tar -C ${VROOT} -zcvf /tmp/codepot-root.tar.gz . @@ -42,19 +43,16 @@ FROM ubuntu:20.04 ARG VROOT -RUN apt update && \ - DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \ - subversion apache2 \ - php libapache2-mod-php php-gd php-sqlite3 php-ldap \ - libapache2-mod-perl2 libapache2-mod-svn \ - libswitch-perl libconfig-simple-perl libdigest-sha-perl \ - libdbd-sqlite3-perl libnet-ldap-perl libsvn-perl libmail-sendmail-perl \ - sqlite3 vim - COPY --from=installer /tmp/codepot-root.tar.gz /tmp -COPY apache2-fg.sh /usr/sbin/ RUN \ + apt update && \ + DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \ + subversion apache2 \ + php libapache2-mod-php php-gd php-sqlite3 php-ldap \ + libapache2-mod-perl2 libapache2-mod-svn \ + libswitch-perl libconfig-simple-perl libdigest-sha-perl \ + libdbd-sqlite3-perl libnet-ldap-perl libsvn-perl libmail-sendmail-perl sqlite3 vim-tiny && \ rm -rf /var/www/html && \ tar -C / -zxvf /tmp/codepot-root.tar.gz && \ a2enmod rewrite && a2enmod headers && \ diff --git a/codepot/docker/Makefile.am b/codepot/docker/Makefile.am index 5426ade9..7fa81f63 100644 --- a/codepot/docker/Makefile.am +++ b/codepot/docker/Makefile.am @@ -1,11 +1,11 @@ -DOCKER ?= docker +DOCKER ?= DOCKER_BUILDKIT=1 docker all: @echo "Choose one of the following targets:" - @echo " rocky ubnt2004" + @echo " rocky ubnt" -ubnt2004: @srcdir@/codepot-@VERSION@.tar.gz - $(DOCKER) build -t codepot:ubnt20.04 -f @srcdir@/Dockerfile.ubnt2004 @srcdir@ || true +ubnt: @srcdir@/codepot-@VERSION@.tar.gz + $(DOCKER) build -t codepot:ubnt -f @srcdir@/Dockerfile.ubnt @srcdir@ || true rm -f @srcdir@/codepot-@VERSION@.tar.gz rocky: @srcdir@/codepot-@VERSION@.tar.gz diff --git a/codepot/docker/Makefile.in b/codepot/docker/Makefile.in index 7669220e..e2589540 100644 --- a/codepot/docker/Makefile.in +++ b/codepot/docker/Makefile.in @@ -410,14 +410,14 @@ uninstall-am: .PRECIOUS: Makefile -DOCKER ?= docker +DOCKER ?= DOCKER_BUILDKIT=1 docker all: @echo "Choose one of the following targets:" - @echo " rocky ubnt2004" + @echo " rocky ubnt" -ubnt2004: @srcdir@/codepot-@VERSION@.tar.gz - $(DOCKER) build -t codepot:ubnt20.04 -f @srcdir@/Dockerfile.ubnt2004 @srcdir@ || true +ubnt: @srcdir@/codepot-@VERSION@.tar.gz + $(DOCKER) build -t codepot:ubnt -f @srcdir@/Dockerfile.ubnt @srcdir@ || true rm -f @srcdir@/codepot-@VERSION@.tar.gz rocky: @srcdir@/codepot-@VERSION@.tar.gz diff --git a/codepot/docker/README.md b/codepot/docker/README.md index b5acbb77..513ce2e5 100644 --- a/codepot/docker/README.md +++ b/codepot/docker/README.md @@ -1,15 +1,15 @@ If you require the root privilege to build a docker image, specify sudo in DOCKER. ``` -make rocky8 DOCKER="sudo docker" -make ubnt2004 DOCKER="sudo docker" +make rocky DOCKER="sudo docker" +make ubnt DOCKER="sudo docker" ``` Run the service like ``` -docker run -dit --restart=unless-stopped --name=codepot codepot:ubnt20.04 -docker run -dit --restart=unless-stopped --name=codepot -p 80:80 codepot:ubnt20.04 -docker run -dit --restart=unless-stopped --name=codepot -p 80:80 -v /home/container-data/codepot:/var/lib/codepot codepot:ubnt20.04 -docker run -dit --restart=unless-stopped --name=codepot -p 1200:1200 -v /home/container-data/codepot:/var/lib/codepot codepot:ubnt20.04 --port 1200 --hide-index-page=yes --https-redirected=yes +docker run -dit --restart=unless-stopped --name=codepot codepot:ubnt +docker run -dit --restart=unless-stopped --name=codepot -p 80:80 codepot:ubnt +docker run -dit --restart=unless-stopped --name=codepot -p 80:80 -v /home/container-data/codepot:/var/lib/codepot codepot:ubnt +docker run -dit --restart=unless-stopped --name=codepot -p 1200:1200 -v /home/container-data/codepot:/var/lib/codepot codepot:ubnt --port 1200 --hide-index-page=yes --https-redirected=yes ``` Run the shell on the existing container for in-container management. diff --git a/codepot/docker/apache2-fg.sh b/codepot/docker/apache2-fg.sh index 5fd15992..d9e0d020 100755 --- a/codepot/docker/apache2-fg.sh +++ b/codepot/docker/apache2-fg.sh @@ -19,7 +19,7 @@ do ;; port=*) SERVICE_PORT=${OPTARG#*=} - opt=${OPTARG%=$val} + opt=${OPTARG%=$val} ;; hide-index-page) @@ -30,7 +30,7 @@ do hide-index-page=*) HIDE_INDEX_PAGE=${OPTARG#*=} - opt=${OPTARG%=$val} + opt=${OPTARG%=$val} ;; https-redirected) @@ -41,11 +41,11 @@ do https-redirected=*) HTTPS_REDIRECTED=${OPTARG#*=} - opt=${OPTARG%=$val} + opt=${OPTARG%=$val} ;; *) - echo "Warning: unknown option - $OPTARG" + echo "Warning: unknown option - $OPTARG" ;; esac ;; @@ -62,14 +62,15 @@ do echo " -hide-index-page yes/no hide/show the index page script from the URL" echo " -https-redirected yes/no indicate if the requets are HTTPS redirected" echo "-------------------------------------------------------------------------" + exit 0 ;; p) SERVICE_PORT=${OPTARG#*=} - opt=${OPTARG%=$val} + opt=${OPTARG%=$val} ;; *) - echo "Warning: unknown option - $OPTARG" + echo "Warning: unknown option - $OPTARG" ;; esac done diff --git a/codepot/docker/httpd-fg.sh b/codepot/docker/httpd-fg.sh index c26973cf..5e91ae0e 100755 --- a/codepot/docker/httpd-fg.sh +++ b/codepot/docker/httpd-fg.sh @@ -19,7 +19,7 @@ do ;; port=*) SERVICE_PORT=${OPTARG#*=} - opt=${OPTARG%=$val} + opt=${OPTARG%=$val} ;; hide-index-page) @@ -30,7 +30,7 @@ do hide-index-page=*) HIDE_INDEX_PAGE=${OPTARG#*=} - opt=${OPTARG%=$val} + opt=${OPTARG%=$val} ;; https-redirected) @@ -41,11 +41,11 @@ do https-redirected=*) HTTPS_REDIRECTED=${OPTARG#*=} - opt=${OPTARG%=$val} + opt=${OPTARG%=$val} ;; *) - echo "Warning: unknown option - $OPTARG" + echo "Warning: unknown option - $OPTARG" ;; esac ;; @@ -62,6 +62,7 @@ do echo " -hide-index-page yes/no hide/show the index page script from the URL" echo " -https-redirected yes/no indicate if the requets are HTTPS redirected" echo "-------------------------------------------------------------------------" + exit 0 ;; p) SERVICE_PORT=${OPTARG#*=} @@ -69,7 +70,7 @@ do ;; *) - echo "Warning: unknown option - $OPTARG" + echo "Warning: unknown option - $OPTARG" ;; esac done