2021-05-26 20:15:55 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-01-28 13:26:42 +00:00
|
|
|
|
|
|
|
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
|
|
|
source ${ABSDIR}/../functions.sh
|
|
|
|
source ${ABSDIR}/vars.sh
|
|
|
|
|
|
|
|
ensure_pwd_is_scriptdir
|
|
|
|
ensure_not_root
|
|
|
|
|
2022-02-13 21:49:28 +00:00
|
|
|
if ! podman volume exists ${srvdata_volume} ; then
|
|
|
|
echo "Error : data volume ${srvdata_volume} does not exists. Consider running 05_freshinstall.sh if this is the first install."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
git clone -b ${version} --depth=1 https://github.com/PrivateBin/docker-nginx-fpm-alpine &&
|
|
|
|
#sed -i 's|fastcgi_pass unix:/run/php-fpm.sock;|fastcgi_pass unix:/run/s6/php-fpm.sock;|' docker-nginx-fpm-alpine/etc/nginx/http.d/site.conf
|
|
|
|
#sed -i 's|pid /run/nginx.pid;|pid /run/s6/nginx.pid;|' docker-nginx-fpm-alpine/etc/nginx/nginx.conf
|
|
|
|
#sed -i 's|listen = /run/php-fpm.sock|listen = /run/s6/php-fpm.sock|' docker-nginx-fpm-alpine/etc/php8/php-fpm.d/zz-docker.conf
|
|
|
|
#cp conf.php docker-nginx-fpm-alpine/conf.php
|
|
|
|
#grep -q conf.php docker-nginx-fpm-alpine/Dockerfile || sed -i '/^COPY.*/a COPY conf.php /srv/cfg/conf.php' docker-nginx-fpm-alpine/Dockerfile
|
|
|
|
podman build -t privatebin-nginx-fpm-alpine docker-nginx-fpm-alpine &&
|
|
|
|
rm -rf docker-nginx-fpm-alpine &&
|
|
|
|
podman volume create ${run_volume} &&
|
|
|
|
podman volume create ${varlibnginxtmp_volume} &&
|
|
|
|
podman unshare chown -R 65534:82 `get_podman_volume_path ${run_volume}` &&
|
|
|
|
podman unshare chown -R 65534:82 `get_podman_volume_path ${varlibnginxtmp_volume}` &&
|
|
|
|
podman run -d --read-only --restart=always --name ${container_name} \
|
|
|
|
-p ${listen_if}:${listen_port}:8080 \
|
|
|
|
-v ${run_volume}:/run:Z \
|
|
|
|
-v ${srvdata_volume}:/srv/data:Z \
|
|
|
|
-v ${varlibnginxtmp_volume}:/var/lib/nginx/tmp:Z \
|
|
|
|
privatebin-nginx-fpm-alpine &&
|
2022-02-14 06:43:58 +00:00
|
|
|
( podman logs -f ${container_name} 2>&1 & ) | grep -q 'NOTICE: ready to handle connections' &&
|
|
|
|
podman stop ${container_name} &&
|
|
|
|
echo Container ${container_name} successfully built and stopped.
|