module/apache: enable python env to run in a container
diff --git a/module/apache/module.sh b/module/apache/module.sh
index 7a96d05..3d30407 100644
--- a/module/apache/module.sh
+++ b/module/apache/module.sh
@@ -60,6 +60,7 @@
 declare -r frontend_d="$mod_staging_d/pelican-subtle-giggi.git"
 declare -r content_d="$mod_staging_d/mdcon.git"
 declare -r pythonenv_d="$mod_staging_d/pelican-venv"
+declare -r pythonenv_con_d="$mod_staging_d/pelican-venv-con"
 
 declare -r pelican_version="4.0.1"
 declare -r markdown_version="3.1.1"
@@ -246,69 +247,92 @@
 	popd &>/dev/null
 }
 
+function __apache_do_global_packages
+{
+	local -r venv_dir=$1; shift
+	# Append flags
+	local install="pip3 install ${@}"
+	local -a global_packages=( "virtualenv" "pip" "wheel" )
+
+	$install --user ${global_packages[@]} 2>&1 | lets -l -x "pip3"
+
+	python3 -m venv "$venv_dir" 2>&1 | lets -l -x "python"
+	[ "${PIPESTATUS[0]}" -eq 0 ] || {
+		lets -l -e "virtual environment: create failed"
+		return $s_err
+	}
+}
+
+function __apache_do_local_packages
+{
+	local -r venv_dir=$1; shift
+	local -r requirements=$1; shift
+	# Append flags
+	local install="pip3 install ${@}"
+	local -a local_packages=(
+		"wheel"
+		"setuptools==$setuptools_version"
+		"pelican==$pelican_version"
+		"markdown==$markdown_version"
+	)
+
+	source "$venv_dir/bin/activate" || return $s_err
+	(
+		$install ${local_packages[@]} 2>&1 | lets -l -x "pip3"
+		[ "${PIPESTATUS[0]}" -eq 0 ] || {
+			deactivate
+			return $s_err2
+		}
+
+		if [ -f "$requirements" ]; then
+		    while read -r pkg; do
+			    $install $pkg 2>&1 | lets -l -x "pip3"
+			    [ "${PIPESTATUS[0]}" -eq 0 ] || {
+				    deactivate
+				    return $s_err3
+			    }
+		    done < "$requirements"
+		else
+			lets -l -w "no requirments file"
+		fi
+
+		deactivate
+	)
+	case "$?" in
+		$s_err2) lets -l -e "install local packages"; return $s_err ;;
+		$s_err3) lets -l -e "install $requirements"; return $s_err ;;
+	esac
+}
+
 # @1      : absolute path to the target directory
 # @2      : (optional) requirements txt file
 function __apache_do_venv
 {
 	local -ar deps=( python3-dev python3-pip python3-venv python3-wheel )
 
-	if [ -z "$1" ] || [ ! -f "$2" ]; then
+	if [ -z "$1" ]; then
 		lets -l -e "virtual environment: invalid params"
 		return $s_err
 	fi
 
 	if [ ! -e "$1/bin/activate" ]; then
-		local install="python3 -m pip install --no-cache-dir --upgrade"
-		local -a global_packages=( "virtualenv" "pip" )
-		local -a local_packages=(
-			"wheel"
-			"setuptools==$setuptools_version"
-			"pelican==$pelican_version"
-			"markdown==$markdown_version"
-		)
-
-		util_install_dependency ${deps[@]} || {
-			lets -l -e "install python dependencies"
-			return $s_err
-		}
+		if which apt-get &>/dev/null; then
+			util_install_dependency ${deps[@]} || {
+				lets -l -e "install python dependencies"
+				return $s_err
+			}
+		fi
 
 		mkdir -p "$1" || {
 			lets -l -e "virtual envirnment: mkdir failed"
 			return $s_err
 		}
 
-		$install --user ${global_packages[@]} 2>&1 | lets -l -x "pip3"
-
-		python3 -m venv "$1" 2>&1 | lets -l -x "python"
-		[ "${PIPESTATUS[0]}" -eq 0 ] || {
-			lets -l -e "virtual environment: create failed"
-			return $s_err
-		}
-
-		source "$1/bin/activate" || return $s_err
-		(
-			$install ${local_packages[@]} 2>&1 | lets -l -x "pip3"
-			[ "${PIPESTATUS[0]}" -eq 0 ] || {
-				deactivate
-				return $s_err2
-			}
-
-			while read -r pkg; do
-				$install $pkg 2>&1 | lets -l -x "pip3"
-				[ "${PIPESTATUS[0]}" -eq 0 ] || {
-					deactivate
-					return $s_err3
-				}
-			done < "$2"
-
-			deactivate
-		)
-		case "$?" in
-			$s_err2) lets -l -e "install local packages"; return $s_err ;;
-			$s_err3) lets -l -e "install $(basename $2)"; return $s_err ;;
-		esac
+		__apache_do_global_packages $1 "--no-cache-dir --upgrade" && \
+		    __apache_do_local_packages $1 $2 "--no-cache-dir --upgrade" || return $s_err
 	else
 		lets -l -w "virtual environment: exists already"
+		__apache_do_local_packages $1 $2 || return $s_err
 	fi
 
 	return $s_ok
@@ -472,7 +496,7 @@
 	lets -l -d "virtual environment: complete"
 
 	pushd $frontend_d &>/dev/null
-	__create_apache_frontend $pythonenv_d 2>&1 | lets -l -x "make"
+	__create_apache_frontend $venv_d 2>&1 | lets -l -x "make"
 	case "${PIPESTATUS[0]}" in
 		$s_ok   ) popd &>/dev/null; return $s_ok          ;;
 		$s_err3 ) lets -l -e "failed to activate python"  ;;