removed the top-level directory
This commit is contained in:
77
docker/Dockerfile.alpine
Normal file
77
docker/Dockerfile.alpine
Normal file
@ -0,0 +1,77 @@
|
||||
ARG VROOT=/tmp/codepot-root
|
||||
|
||||
### -------------------------------------------------------------------------------
|
||||
|
||||
FROM alpine:3.15 as installer
|
||||
|
||||
ARG VROOT
|
||||
|
||||
RUN apk add --no-cache \
|
||||
php7-dev subversion-dev make gcc musl-dev \
|
||||
apache2 apache2-dev perl-dev alpine-sdk
|
||||
|
||||
COPY codepot-0.4.0.tar.gz /tmp
|
||||
COPY apache2-mod-perl/APKBUILD /tmp
|
||||
COPY apache2-mod-perl/apache2-mod-perl.conf /tmp
|
||||
|
||||
RUN \
|
||||
cd /tmp && \
|
||||
abuild-keygen -n -a && \
|
||||
cp -pfr /root/.abuild/*.rsa.pub /etc/apk/keys/ && \
|
||||
abuild -F -d && \
|
||||
tar -zxvf codepot-0.4.0.tar.gz && \
|
||||
cd codepot-0.4.0 && \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--libdir=/usr/lib64 \
|
||||
--sysconfdir=/etc \
|
||||
--with-wwwdir=/var/www/html \
|
||||
--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` \
|
||||
--with-phpextinidir=/etc/php7/conf.d \
|
||||
make && make install DESTDIR=${VROOT} && rm -rf ${VROOT}/var/lib/codepot/*
|
||||
|
||||
RUN sed -ri -e 's|^database_hostname[[:space:]]*=[[:space:]]*"localhost"$|database_hostname = "/var/lib/codepot/codepot.db"|g' \
|
||||
-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
|
||||
|
||||
RUN mkdir -p ${VROOT}/etc/apache2/conf.d && echo LoadModule dav_svn_module modules/mod_dav_svn.so > ${VROOT}/etc/apache2/conf.d/mod_dav_svn.conf
|
||||
|
||||
COPY alpine-httpd-fg.sh ${VROOT}/usr/sbin/
|
||||
RUN tar -C ${VROOT} -zcvf /tmp/codepot-root.tar.gz .
|
||||
|
||||
|
||||
### -------------------------------------------------------------------------------
|
||||
|
||||
FROM alpine:3.15
|
||||
|
||||
ARG VROOT
|
||||
|
||||
COPY --from=installer /tmp/codepot-root.tar.gz /tmp
|
||||
COPY --from=installer /root/packages/x86_64/apache2-mod-perl-2.0.12-r1.apk /tmp
|
||||
|
||||
RUN \
|
||||
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \
|
||||
subversion apache2 libldap \
|
||||
php7-apache2 php7-gd php7-sqlite3 php7-ldap php7-mbstring php7-ctype \
|
||||
php7-iconv php7-pdo php7-pdo_sqlite php7-pdo_mysql php7-zip \
|
||||
apache2-webdav mod_dav_svn \
|
||||
perl-switch perl-config-simple perl-digest-sha1 \
|
||||
perl-dbd-sqlite perl-ldap perl-subversion perl-mail-sendmail sqlite bash && \
|
||||
apk add --allow-untrusted /tmp/apache2-mod-perl-2.0.12-r1.apk && \
|
||||
rm -rf /var/www/html && \
|
||||
tar -C / -zxvf /tmp/codepot-root.tar.gz && \
|
||||
cp -pf /etc/codepot/codepot.httpd /etc/apache2/conf.d/codepot.conf && \
|
||||
echo "PerlSwitches -Mlib=/etc/codepot/perl" >> /etc/apache2/conf.d/perl.conf && \
|
||||
sed -ri -e 's|^max_execution_time[[:space:]]*=.*$|max_execution_time = 120|g' /etc/php7/php.ini && \
|
||||
sed -ri -e 's|/var/www/localhost/htdocs|/var/www/html|g' \
|
||||
-e 's|^User apache$|User nobody|g' \
|
||||
-e 's|^Gruop apache$|Group nobody|g' \
|
||||
-e 's|^#(LoadModule rewrite_module modules/mod_rewrite.so)|\1|g' \
|
||||
-e 's|AllowOverride None|AllowOverride All|g' /etc/apache2/httpd.conf && \
|
||||
rm -rf /tmp/*
|
||||
|
||||
ENTRYPOINT ["/usr/sbin/alpine-httpd-fg.sh"]
|
64
docker/Dockerfile.rocky
Normal file
64
docker/Dockerfile.rocky
Normal file
@ -0,0 +1,64 @@
|
||||
ARG VROOT=/tmp/codepot-root
|
||||
|
||||
### -------------------------------------------------------------------------------
|
||||
|
||||
FROM rockylinux/rockylinux:8 as installer
|
||||
|
||||
ARG VROOT
|
||||
|
||||
RUN dnf install -y php-devel subversion-devel perl-devel perl-Digest-SHA make
|
||||
|
||||
COPY codepot-0.4.0.tar.gz /tmp
|
||||
|
||||
RUN \
|
||||
cd /tmp && \
|
||||
tar -zxvf codepot-0.4.0.tar.gz && \
|
||||
cd codepot-0.4.0 && \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--libdir=/usr/lib64 \
|
||||
--sysconfdir=/etc \
|
||||
--with-wwwdir=/var/www/html \
|
||||
--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 DESTDIR=${VROOT} && rm -rf ${VROOT}/var/lib/codepot/*
|
||||
|
||||
RUN sed -ri -e 's|^database_hostname[[:space:]]*=[[:space:]]*"localhost"$|database_hostname = "/var/lib/codepot/codepot.db"|g' \
|
||||
-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 .
|
||||
|
||||
### -------------------------------------------------------------------------------
|
||||
|
||||
FROM rockylinux/rockylinux:8
|
||||
|
||||
ARG VROOT
|
||||
|
||||
COPY --from=installer /tmp/codepot-root.tar.gz /tmp
|
||||
##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 php-mbstring php-zip \
|
||||
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 && \
|
||||
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 && \
|
||||
rm -rf /tmp/*
|
||||
|
||||
##CMD ["/usr/sbin/httpd-fg.sh"]
|
||||
ENTRYPOINT ["/usr/sbin/httpd-fg.sh"]
|
64
docker/Dockerfile.ubnt
Normal file
64
docker/Dockerfile.ubnt
Normal file
@ -0,0 +1,64 @@
|
||||
ARG VROOT=/tmp/codepot-root
|
||||
|
||||
### -------------------------------------------------------------------------------
|
||||
|
||||
FROM ubuntu:20.04 as installer
|
||||
|
||||
ARG VROOT
|
||||
|
||||
RUN apt update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
|
||||
php-dev libsvn-dev make
|
||||
|
||||
COPY codepot-0.4.0.tar.gz /tmp
|
||||
|
||||
RUN \
|
||||
cd /tmp && \
|
||||
tar -zxvf codepot-0.4.0.tar.gz && \
|
||||
cd codepot-0.4.0 && \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--libdir=/usr/lib64 \
|
||||
--sysconfdir=/etc \
|
||||
--with-wwwdir=/var/www/html \
|
||||
--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` \
|
||||
--with-phpextinidir=`php-config --ini-dir | sed 's|/cli/|/apache2/|g'` && \
|
||||
make && make install DESTDIR=${VROOT} && rm -rf ${VROOT}/var/lib/codepot/*
|
||||
|
||||
RUN sed -ri -e 's|^database_hostname[[:space:]]*=[[:space:]]*"localhost"$|database_hostname = "/var/lib/codepot/codepot.db"|g' \
|
||||
-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 .
|
||||
|
||||
|
||||
### -------------------------------------------------------------------------------
|
||||
|
||||
FROM ubuntu:20.04
|
||||
|
||||
ARG VROOT
|
||||
|
||||
COPY --from=installer /tmp/codepot-root.tar.gz /tmp
|
||||
|
||||
RUN \
|
||||
apt update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
|
||||
subversion apache2 \
|
||||
php libapache2-mod-php php-gd php-sqlite3 php-ldap php-mbstring php-zip \
|
||||
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 && \
|
||||
cp -pf /etc/codepot/codepot.httpd /etc/apache2/conf-enabled/codepot.conf && \
|
||||
echo "PerlSwitches -Mlib=/etc/codepot/perl" >> /etc/apache2/conf-enabled/perl.conf && \
|
||||
sed -ri -e 's|^max_execution_time[[:space:]]*=.*$|max_execution_time = 120|g' /etc/php/*/apache2/php.ini && \
|
||||
rm -rf /tmp/*
|
||||
|
||||
ENTRYPOINT ["/usr/sbin/apache2-fg.sh"]
|
29
docker/Makefile.am
Normal file
29
docker/Makefile.am
Normal file
@ -0,0 +1,29 @@
|
||||
##DOCKER ?= DOCKER_BUILDKIT=1 docker
|
||||
DOCKER ?= docker
|
||||
|
||||
all:
|
||||
@echo "Choose one of the following targets:"
|
||||
@echo " alpine rocky ubnt"
|
||||
|
||||
alpine: @srcdir@/codepot-@VERSION@.tar.gz
|
||||
$(DOCKER) build -t codepot:alpine -f @srcdir@/Dockerfile.alpine @srcdir@ || true
|
||||
rm -f @srcdir@/codepot-@VERSION@.tar.gz
|
||||
|
||||
rocky: @srcdir@/codepot-@VERSION@.tar.gz
|
||||
$(DOCKER) build -t codepot:rocky -f @srcdir@/Dockerfile.rocky @srcdir@ || true
|
||||
rm -f @srcdir@/codepot-@VERSION@.tar.gz
|
||||
|
||||
ubnt: @srcdir@/codepot-@VERSION@.tar.gz
|
||||
$(DOCKER) build -t codepot:ubnt -f @srcdir@/Dockerfile.ubnt @srcdir@ || true
|
||||
rm -f @srcdir@/codepot-@VERSION@.tar.gz
|
||||
|
||||
push:
|
||||
$(DOCKER) tag codepot:rocky hyunghwan/codepot:rocky
|
||||
$(DOCKER) tag codepot:ubnt hyunghwan/codepot:ubnt
|
||||
$(DOCKER) push hyunghwan/codepot:rocky
|
||||
$(DOCKER) push hyunghwan/codepot:ubnt
|
||||
|
||||
@srcdir@/codepot-@VERSION@.tar.gz:
|
||||
cd .. && make dist
|
||||
cp ../codepot-@VERSION@.tar.gz @srcdir@/
|
||||
|
443
docker/Makefile.in
Normal file
443
docker/Makefile.in
Normal file
@ -0,0 +1,443 @@
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
subdir = docker
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/ac/m4/as-ac-expand.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/./config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in README.md
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BINDIR = @BINDIR@
|
||||
CACHEDIR = @CACHEDIR@
|
||||
CFGDIR = @CFGDIR@
|
||||
CSCOPE = @CSCOPE@
|
||||
CTAGS = @CTAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DATADIR = @DATADIR@
|
||||
DATAROOTDIR = @DATAROOTDIR@
|
||||
DEFS = @DEFS@
|
||||
DEPOTDIR = @DEPOTDIR@
|
||||
DOCDIR = @DOCDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
ETAGS = @ETAGS@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LIBDIR = @LIBDIR@
|
||||
LIBEXECDIR = @LIBEXECDIR@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LOCALSTATEDIR = @LOCALSTATEDIR@
|
||||
LOGDIR = @LOGDIR@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PHPEXTDIR = @PHPEXTDIR@
|
||||
PHPEXTINIDIR = @PHPEXTINIDIR@
|
||||
PREFIX = @PREFIX@
|
||||
RM = @RM@
|
||||
RMDIR = @RMDIR@
|
||||
SBINDIR = @SBINDIR@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
SYSCONFDIR = @SYSCONFDIR@
|
||||
VERSION = @VERSION@
|
||||
WWWDIR = @WWWDIR@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
cachedir = @cachedir@
|
||||
cfgdir = @cfgdir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
depotdir = @depotdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
logdir = @logdir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
phpextdir = @phpextdir@
|
||||
phpextinidir = @phpextinidir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
wwwdir = @wwwdir@
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docker/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign docker/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
tags TAGS:
|
||||
|
||||
ctags CTAGS:
|
||||
|
||||
cscope cscopelist:
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic cscopelist-am \
|
||||
ctags-am distclean distclean-generic distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||
pdf-am ps ps-am tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
DOCKER ?= docker
|
||||
|
||||
all:
|
||||
@echo "Choose one of the following targets:"
|
||||
@echo " alpine rocky ubnt"
|
||||
|
||||
alpine: @srcdir@/codepot-@VERSION@.tar.gz
|
||||
$(DOCKER) build -t codepot:alpine -f @srcdir@/Dockerfile.alpine @srcdir@ || true
|
||||
rm -f @srcdir@/codepot-@VERSION@.tar.gz
|
||||
|
||||
rocky: @srcdir@/codepot-@VERSION@.tar.gz
|
||||
$(DOCKER) build -t codepot:rocky -f @srcdir@/Dockerfile.rocky @srcdir@ || true
|
||||
rm -f @srcdir@/codepot-@VERSION@.tar.gz
|
||||
|
||||
ubnt: @srcdir@/codepot-@VERSION@.tar.gz
|
||||
$(DOCKER) build -t codepot:ubnt -f @srcdir@/Dockerfile.ubnt @srcdir@ || true
|
||||
rm -f @srcdir@/codepot-@VERSION@.tar.gz
|
||||
|
||||
push:
|
||||
$(DOCKER) tag codepot:rocky hyunghwan/codepot:rocky
|
||||
$(DOCKER) tag codepot:ubnt hyunghwan/codepot:ubnt
|
||||
$(DOCKER) push hyunghwan/codepot:rocky
|
||||
$(DOCKER) push hyunghwan/codepot:ubnt
|
||||
|
||||
@srcdir@/codepot-@VERSION@.tar.gz:
|
||||
cd .. && make dist
|
||||
cp ../codepot-@VERSION@.tar.gz @srcdir@/
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
18
docker/README.md
Normal file
18
docker/README.md
Normal file
@ -0,0 +1,18 @@
|
||||
If you require the root privilege to build a docker image, specify sudo in DOCKER.
|
||||
```
|
||||
make rocky DOCKER="sudo docker"
|
||||
make ubnt DOCKER="sudo docker"
|
||||
```
|
||||
|
||||
Run the service like
|
||||
```
|
||||
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.
|
||||
```
|
||||
docker exec -it codepot /bin/bash
|
||||
```
|
192
docker/alpine-httpd-fg.sh
Executable file
192
docker/alpine-httpd-fg.sh
Executable file
@ -0,0 +1,192 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CODEPOT_CONFIG_FILE="/var/lib/codepot/codepot.ini"
|
||||
HTTPD_CONFIG_FILE="/etc/apache2/httpd.conf"
|
||||
|
||||
SERVICE_PORT=""
|
||||
HIDE_INDEX_PAGE=""
|
||||
HTTPS_REDIRECTED=""
|
||||
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}
|
||||
;;
|
||||
|
||||
hide-index-page)
|
||||
opt=${OPTARG}
|
||||
HIDE_INDEX_PAGE="${!OPTIND}"
|
||||
OPTIND=$(($OPTIND + 1))
|
||||
;;
|
||||
|
||||
hide-index-page=*)
|
||||
HIDE_INDEX_PAGE=${OPTARG#*=}
|
||||
opt=${OPTARG%=$val}
|
||||
;;
|
||||
|
||||
https-redirected)
|
||||
opt=${OPTARG}
|
||||
HTTPS_REDIRECTED="${!OPTIND}"
|
||||
OPTIND=$(($OPTIND + 1))
|
||||
;;
|
||||
|
||||
https-redirected=*)
|
||||
HTTPS_REDIRECTED=${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 " -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}
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Warning: unknown option - $OPTARG"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
## fall back to default values if the given values are not proper
|
||||
echo "${SERVICE_PORT}" | grep -q -E '^[[:digit:]]+$' || SERVICE_PORT="80"
|
||||
[[ "${HIDE_INDEX_PAGE}" == "" ]] && HIDE_INDEX_PAGE="no"
|
||||
[[ "${HTTPS_REDIRECTED}" == "" ]] && HTTPS_REDIRECTED="no"
|
||||
|
||||
|
||||
# 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/apache2}"
|
||||
: "${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/apache2}"
|
||||
: "${APACHE_PID_FILE:=$APACHE_RUN_DIR/apache2.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
|
||||
|
||||
chown nobody:nobody /var/lib/codepot
|
||||
|
||||
for i in /var/cache/codepot /var/log/codepot \
|
||||
/var/lib/codepot/attachments \
|
||||
/var/lib/codepot/files \
|
||||
/var/lib/codepot/issuefiles \
|
||||
/var/lib/codepot/svnrepo \
|
||||
/var/lib/codepot/usericons
|
||||
do
|
||||
[ ! -d "$i" ] && {
|
||||
mkdir -p "$i"
|
||||
chown nobody:nobody "$i"
|
||||
}
|
||||
done
|
||||
|
||||
[ ! -f /var/lib/codepot/codepot.db ] && {
|
||||
sqlite3 -init /etc/codepot/codepot.sqlite /var/lib/codepot/codepot.db ""
|
||||
chown nobody:nobody /var/lib/codepot/codepot.db
|
||||
}
|
||||
|
||||
[ ! -f "${CODEPOT_CONFIG_FILE}" ] && {
|
||||
cp -pf /etc/codepot/codepot.ini "${CODEPOT_CONFIG_FILE}"
|
||||
chown nobody:nobody "${CODEPOT_CONFIG_FILE}"
|
||||
}
|
||||
|
||||
grep -F -q '<Location "/">' /etc/apache2/conf.d/codepot.conf || {
|
||||
cat <<EOF >> /etc/apache2/conf.d/codepot.conf
|
||||
<Location "/">
|
||||
SetEnv CODEPOT_CONFIG_FILE ${CODEPOT_CONFIG_FILE}
|
||||
</Location>
|
||||
EOF
|
||||
}
|
||||
|
||||
sed -r -i "s|PerlSetEnv CODEPOT_CONFIG_FILE .*\$|PerlSetEnv CODEPOT_CONFIG_FILE ${CODEPOT_CONFIG_FILE}|g" /etc/apache2/conf.d/codepot.conf
|
||||
|
||||
|
||||
## change the port number as specified on the command line
|
||||
echo "Configuring to listen on the port[$SERVICE_PORT] hide-index-page[$HIDE_INDEX_PAGE] https-redirected[$HTTPS_REDIRECTED]"
|
||||
|
||||
sed -r -i "s|^Listen[[:space:]]+.*|Listen ${SERVICE_PORT}|g" "${HTTPD_CONFIG_FILE}"
|
||||
|
||||
if [[ "${HTTPS_REDIRECTED}" =~ [Yy][Ee][Ss] ]]
|
||||
then
|
||||
## The DAV COPY request contains the header 'Destination: https://' if the origin request
|
||||
## is HTTPS. This container is configured to server on HTTP only. If HTTPS is redirected
|
||||
## to HTTP, we must translate https:// to http:// in the Destination header.
|
||||
## Otherwise, the response is 502 Bad Gateway.
|
||||
echo "RequestHeader edit Destination ^https: http: early" > /etc/apache2/conf.d/codepot-dav-https-redirected.conf
|
||||
else
|
||||
rm -f /etc/apache2/conf.d/codepot-dav-https-redirected.conf
|
||||
fi
|
||||
|
||||
if [[ "${HIDE_INDEX_PAGE}" =~ [Yy][Ee][Ss] ]]
|
||||
then
|
||||
sed -r -i 's|^index_page[[:space:]]*=.*$|index_page=""|g' "${CODEPOT_CONFIG_FILE}"
|
||||
|
||||
echo 'RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php/$1 [L]' > /var/www/html/.htaccess
|
||||
|
||||
sed -r -i '/<Directory \/var\/www\/>/,/<\/Directory>/s|^[[:space:]]*AllowOverride[[:space:]]+.*$|\tAllowOverride All|g' "${HTTPD_CONFIG_FILE}"
|
||||
|
||||
else
|
||||
sed -r -i 's|^index_page[[:space:]]*=.*$|index_page="index.php"|g' "${CODEPOT_CONFIG_FILE}"
|
||||
rm -rf /var/www/html/.htaccess
|
||||
|
||||
sed -r -i '/<Directory \/var\/www\/>/,/<\/Directory>/s|^[[:space:]]*AllowOverride[[:space:]]+.*$|\tAllowOverride None|g' "${HTTPD_CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
#httpd server in the foreground
|
||||
exec httpd -DFOREGROUND
|
193
docker/apache2-fg.sh
Executable file
193
docker/apache2-fg.sh
Executable file
@ -0,0 +1,193 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CODEPOT_CONFIG_FILE="/var/lib/codepot/codepot.ini"
|
||||
HTTPD_CONFIG_FILE="/etc/apache2/apache2.conf"
|
||||
|
||||
SERVICE_PORT=""
|
||||
HIDE_INDEX_PAGE=""
|
||||
HTTPS_REDIRECTED=""
|
||||
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}
|
||||
;;
|
||||
|
||||
hide-index-page)
|
||||
opt=${OPTARG}
|
||||
HIDE_INDEX_PAGE="${!OPTIND}"
|
||||
OPTIND=$(($OPTIND + 1))
|
||||
;;
|
||||
|
||||
hide-index-page=*)
|
||||
HIDE_INDEX_PAGE=${OPTARG#*=}
|
||||
opt=${OPTARG%=$val}
|
||||
;;
|
||||
|
||||
https-redirected)
|
||||
opt=${OPTARG}
|
||||
HTTPS_REDIRECTED="${!OPTIND}"
|
||||
OPTIND=$(($OPTIND + 1))
|
||||
;;
|
||||
|
||||
https-redirected=*)
|
||||
HTTPS_REDIRECTED=${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 " -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}
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Warning: unknown option - $OPTARG"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
## fall back to default values if the given values are not proper
|
||||
echo "${SERVICE_PORT}" | grep -q -E '^[[:digit:]]+$' || SERVICE_PORT="80"
|
||||
[[ "${HIDE_INDEX_PAGE}" == "" ]] && HIDE_INDEX_PAGE="no"
|
||||
[[ "${HTTPS_REDIRECTED}" == "" ]] && HTTPS_REDIRECTED="no"
|
||||
|
||||
|
||||
# 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/apache2}"
|
||||
: "${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/apache2}"
|
||||
: "${APACHE_PID_FILE:=$APACHE_RUN_DIR/apache2.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
|
||||
|
||||
chown www-data:www-data /var/lib/codepot
|
||||
|
||||
for i in /var/cache/codepot /var/log/codepot \
|
||||
/var/lib/codepot/attachments \
|
||||
/var/lib/codepot/files \
|
||||
/var/lib/codepot/issuefiles \
|
||||
/var/lib/codepot/svnrepo \
|
||||
/var/lib/codepot/usericons
|
||||
do
|
||||
[ ! -d "$i" ] && {
|
||||
mkdir -p "$i"
|
||||
chown www-data:www-data "$i"
|
||||
}
|
||||
done
|
||||
|
||||
[ ! -f /var/lib/codepot/codepot.db ] && {
|
||||
sqlite3 -init /etc/codepot/codepot.sqlite /var/lib/codepot/codepot.db ""
|
||||
chown www-data:www-data /var/lib/codepot/codepot.db
|
||||
}
|
||||
|
||||
[ ! -f "${CODEPOT_CONFIG_FILE}" ] && {
|
||||
cp -pf /etc/codepot/codepot.ini "${CODEPOT_CONFIG_FILE}"
|
||||
chown www-data:www-data "${CODEPOT_CONFIG_FILE}"
|
||||
}
|
||||
|
||||
grep -F -q '<Location "/">' /etc/apache2/conf-enabled/codepot.conf || {
|
||||
cat <<EOF >> /etc/apache2/conf-enabled/codepot.conf
|
||||
<Location "/">
|
||||
SetEnv CODEPOT_CONFIG_FILE ${CODEPOT_CONFIG_FILE}
|
||||
</Location>
|
||||
EOF
|
||||
}
|
||||
|
||||
sed -r -i "s|PerlSetEnv CODEPOT_CONFIG_FILE .*\$|PerlSetEnv CODEPOT_CONFIG_FILE ${CODEPOT_CONFIG_FILE}|g" /etc/apache2/conf-enabled/codepot.conf
|
||||
|
||||
|
||||
## change the port number as specified on the command line
|
||||
echo "Configuring to listen on the port[$SERVICE_PORT] hide-index-page[$HIDE_INDEX_PAGE] https-redirected[$HTTPS_REDIRECTED]"
|
||||
|
||||
sed -r -i "s|^Listen[[:space:]]+.*|Listen ${SERVICE_PORT}|g" "/etc/apache2/ports.conf"
|
||||
sed -r -i "s|^<VirtualHost .+$|<VirtualHost *:${SERVICE_PORT}>|g" "/etc/apache2/sites-available/000-default.conf"
|
||||
|
||||
if [[ "${HTTPS_REDIRECTED}" =~ [Yy][Ee][Ss] ]]
|
||||
then
|
||||
## The DAV COPY request contains the header 'Destination: https://' if the origin request
|
||||
## is HTTPS. This container is configured to server on HTTP only. If HTTPS is redirected
|
||||
## to HTTP, we must translate https:// to http:// in the Destination header.
|
||||
## Otherwise, the response is 502 Bad Gateway.
|
||||
echo "RequestHeader edit Destination ^https: http: early" > /etc/apache2/conf-enabled/codepot-dav-https-redirected.conf
|
||||
else
|
||||
rm -f /etc/apache2/conf-enabled/codepot-dav-https-redirected.conf
|
||||
fi
|
||||
|
||||
if [[ "${HIDE_INDEX_PAGE}" =~ [Yy][Ee][Ss] ]]
|
||||
then
|
||||
sed -r -i 's|^index_page[[:space:]]*=.*$|index_page=""|g' "${CODEPOT_CONFIG_FILE}"
|
||||
|
||||
echo 'RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php/$1 [L]' > /var/www/html/.htaccess
|
||||
|
||||
sed -r -i '/<Directory \/var\/www\/>/,/<\/Directory>/s|^[[:space:]]*AllowOverride[[:space:]]+.*$|\tAllowOverride All|g' "${HTTPD_CONFIG_FILE}"
|
||||
|
||||
else
|
||||
sed -r -i 's|^index_page[[:space:]]*=.*$|index_page="index.php"|g' "${CODEPOT_CONFIG_FILE}"
|
||||
rm -rf /var/www/html/.htaccess
|
||||
|
||||
sed -r -i '/<Directory \/var\/www\/>/,/<\/Directory>/s|^[[:space:]]*AllowOverride[[:space:]]+.*$|\tAllowOverride None|g' "${HTTPD_CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
#httpd server in the foreground
|
||||
exec apache2 -DFOREGROUND
|
54
docker/apache2-mod-perl/APKBUILD
Normal file
54
docker/apache2-mod-perl/APKBUILD
Normal file
@ -0,0 +1,54 @@
|
||||
# Contributor: Valery Kartel <valery.kartel@gmail.com>
|
||||
# Contributor: Matt Smith <mcs@darkregion.net>
|
||||
# Maintainer: Matt Smith <mcs@darkregion.net>
|
||||
pkgname=apache2-mod-perl
|
||||
_pkgreal=mod_perl
|
||||
pkgver=2.0.12
|
||||
pkgrel=1
|
||||
pkgdesc="Perl Module for Apache2"
|
||||
url="https://perl.apache.org/"
|
||||
arch="all"
|
||||
license="Apache-2.0"
|
||||
depends="apache2"
|
||||
depends_dev="$pkgname"
|
||||
makedepends="apache2-dev perl-dev apr-dev apr-util-dev"
|
||||
options="!check" # fails to start test server
|
||||
subpackages="$pkgname-dbg $pkgname-doc $pkgname-dev"
|
||||
source="https://archive.apache.org/dist/perl/$_pkgreal-$pkgver.tar.gz
|
||||
$pkgname.conf"
|
||||
builddir="$srcdir/$_pkgreal-$pkgver"
|
||||
|
||||
build() {
|
||||
perl Makefile.PL \
|
||||
INSTALLDIRS=vendor \
|
||||
MP_APXS=/usr/bin/apxs
|
||||
make
|
||||
}
|
||||
|
||||
check() {
|
||||
make test
|
||||
}
|
||||
|
||||
|
||||
package() {
|
||||
make DESTDIR="$pkgdir" install
|
||||
find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete
|
||||
install -Dm644 "$srcdir"/$pkgname.conf \
|
||||
"$pkgdir"/etc/apache2/conf.d/$_pkgreal.conf
|
||||
}
|
||||
|
||||
dev() {
|
||||
default_dev
|
||||
|
||||
mv "$pkgdir"/usr/bin "$subpkgdir"/usr
|
||||
|
||||
mkdir -p "$subpkgdir"/usr/lib/perl5/vendor_perl/auto/Apache2
|
||||
mv "$pkgdir"/usr/lib/perl5/vendor_perl/auto/Apache2/Build \
|
||||
"$pkgdir"/usr/lib/perl5/vendor_perl/auto/Apache2/typemap \
|
||||
"$subpkgdir"/usr/lib/perl5/vendor_perl/auto/Apache2
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
890dca0950847e32180485cabbeffbf236af2c92c7df957a233c210022b5172957eddb1db3e9281b87cd438d2fa404a05ae99c7eda098267c68d5e9262b400b0 mod_perl-2.0.12.tar.gz
|
||||
aa6acb5dc403dad0ed9761a3fb4121a4c73c247e0fce9615ff571c7071d2d1bf88fca140f304b2d559a7c153af317dddc0acbacf1ea86cb35becd757ee9a00bb apache2-mod-perl.conf
|
||||
"
|
8
docker/apache2-mod-perl/apache2-mod-perl.conf
Normal file
8
docker/apache2-mod-perl/apache2-mod-perl.conf
Normal file
@ -0,0 +1,8 @@
|
||||
LoadModule perl_module modules/mod_perl.so
|
||||
|
||||
##<Location /cgi-bin>
|
||||
## AddHandler perl-script .pl
|
||||
## PerlResponseHandler ModPerl::Registry
|
||||
## PerlOptions +ParseHeaders
|
||||
## Options +ExecCGI
|
||||
##</Location>
|
186
docker/httpd-fg.sh
Executable file
186
docker/httpd-fg.sh
Executable file
@ -0,0 +1,186 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CODEPOT_CONFIG_FILE="/var/lib/codepot/codepot.ini"
|
||||
HTTPD_CONFIG_FILE="/etc/httpd/conf/httpd.conf"
|
||||
|
||||
SERVICE_PORT=""
|
||||
HIDE_INDEX_PAGE=""
|
||||
HTTPS_REDIRECTED=""
|
||||
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}
|
||||
;;
|
||||
|
||||
hide-index-page)
|
||||
opt=${OPTARG}
|
||||
HIDE_INDEX_PAGE="${!OPTIND}"
|
||||
OPTIND=$(($OPTIND + 1))
|
||||
;;
|
||||
|
||||
hide-index-page=*)
|
||||
HIDE_INDEX_PAGE=${OPTARG#*=}
|
||||
opt=${OPTARG%=$val}
|
||||
;;
|
||||
|
||||
https-redirected)
|
||||
opt=${OPTARG}
|
||||
HTTPS_REDIRECTED="${!OPTIND}"
|
||||
OPTIND=$(($OPTIND + 1))
|
||||
;;
|
||||
|
||||
https-redirected=*)
|
||||
HTTPS_REDIRECTED=${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 " -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}
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Warning: unknown option - $OPTARG"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
## fall back to default values if the given values are not proper
|
||||
echo "${SERVICE_PORT}" | grep -q -E '^[[:digit:]]+$' || SERVICE_PORT="80"
|
||||
[[ "${HIDE_INDEX_PAGE}" == "" ]] && HIDE_INDEX_PAGE="no"
|
||||
[[ "${HTTPS_REDIRECTED}" == "" ]] && HTTPS_REDIRECTED="no"
|
||||
|
||||
# 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
|
||||
|
||||
chown apache:apache /var/lib/codepot
|
||||
|
||||
for i in /var/cache/codepot /var/log/codepot \
|
||||
/var/lib/codepot/attachments \
|
||||
/var/lib/codepot/files \
|
||||
/var/lib/codepot/issuefiles \
|
||||
/var/lib/codepot/svnrepo \
|
||||
/var/lib/codepot/usericons
|
||||
do
|
||||
[ ! -d "$i" ] && {
|
||||
mkdir -p "$i"
|
||||
chown apache:apache "$i"
|
||||
}
|
||||
done
|
||||
|
||||
[ ! -f /var/lib/codepot/codepot.db ] && {
|
||||
sqlite3 -init /etc/codepot/codepot.sqlite /var/lib/codepot/codepot.db ""
|
||||
chown apache:apache /var/lib/codepot/codepot.db
|
||||
}
|
||||
|
||||
[ ! -f "${CODEPOT_CONFIG_FILE}" ] && {
|
||||
cp -pf /etc/codepot/codepot.ini "${CODEPOT_CONFIG_FILE}"
|
||||
chown apache:apache "${CODEPOT_CONFIG_FILE}"
|
||||
}
|
||||
|
||||
grep -F -q 'env[CODEPOT_CONFIG_FILE]' /etc/php-fpm.d/www.conf || {
|
||||
echo "env[CODEPOT_CONFIG_FILE] = ${CODEPOT_CONFIG_FILE}" >> /etc/php-fpm.d/www.conf
|
||||
}
|
||||
|
||||
sed -r -i "s|PerlSetEnv CODEPOT_CONFIG_FILE .*\$|PerlSetEnv CODEPOT_CONFIG_FILE ${CODEPOT_CONFIG_FILE}|g" /etc/httpd/conf.d/codepot.conf
|
||||
|
||||
## change the port number as specified on the command line
|
||||
echo "Configuring to listen on the port[$SERVICE_PORT] hide-index-page[$HIDE_INDEX_PAGE] https-redirected[$HTTPS_REDIRECTED]"
|
||||
|
||||
sed -r -i "s|^Listen[[:space:]]+.*|Listen ${SERVICE_PORT}|g" "${HTTPD_CONFIG_FILE}"
|
||||
|
||||
if [[ "${HTTPS_REDIRECTED}" =~ [Yy][Ee][Ss] ]]
|
||||
then
|
||||
## The DAV COPY request contains the header 'Destination: https://' if the origin request
|
||||
## is HTTPS. This container is configured to server on HTTP only. If HTTPS is redirected
|
||||
## to HTTP, we must translate https:// to http:// in the Destination header.
|
||||
## Otherwise, the response is 502 Bad Gateway.
|
||||
echo "RequestHeader edit Destination ^https: http: early" > /etc/httpd/conf.d/codepot-dav-https-redirected.conf
|
||||
else
|
||||
rm -f /etc/httpd/conf.d/codepot-dav-https-redirected.conf
|
||||
fi
|
||||
|
||||
if [[ "${HIDE_INDEX_PAGE}" =~ [Yy][Ee][Ss] ]]
|
||||
then
|
||||
sed -r -i 's|^index_page[[:space:]]*=.*$|index_page=""|g' "${CODEPOT_CONFIG_FILE}"
|
||||
|
||||
echo 'RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php/$1 [L]' > /var/www/html/.htaccess
|
||||
|
||||
sed -r -i '/<Directory "\/var\/www\/html">/,/<\/Directory>/s|^[[:space:]]*AllowOverride[[:space:]]+.*$| AllowOverride All|g' "${HTTPD_CONFIG_FILE}"
|
||||
|
||||
else
|
||||
sed -r -i 's|^index_page[[:space:]]*=.*$|index_page="index.php"|g' "${CODEPOT_CONFIG_FILE}"
|
||||
rm -rf /var/www/html/.htaccess
|
||||
|
||||
sed -r -i '/<Directory "\/var\/www\/html">/,/<\/Directory>/s|^[[:space:]]*AllowOverride[[:space:]]+.*$| AllowOverride None|g' "${HTTPD_CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
php-fpm
|
||||
exec httpd -DFOREGROUND
|
Reference in New Issue
Block a user