Privatebin : split ci_build_images.sh + migrate to registry

This commit is contained in:
Gitouche 2022-08-15 10:31:39 +02:00
parent c2de331285
commit d6fed78757
4 changed files with 25 additions and 7 deletions

View file

@ -10,6 +10,7 @@ privatebin:
stage: test stage: test
script: script:
- cd podman-privatebin - cd podman-privatebin
- ./ci_build_images.sh
- GARBAYE_PRIVATEBIN_ENV_LISTENPORT=18084 ./05_freshinstall.sh - GARBAYE_PRIVATEBIN_ENV_LISTENPORT=18084 ./05_freshinstall.sh
- ./20_enable.sh - ./20_enable.sh
- ./30_start.sh && sleep 10 - ./30_start.sh && sleep 10

View file

@ -12,10 +12,7 @@ if ! podman volume exists ${srvdata_volume} ; then
exit 1 exit 1
fi fi
git clone -b ${version} --depth=1 https://github.com/PrivateBin/docker-nginx-fpm-alpine && podman pull "${privatebin_image}":"${privatebin_version}" &&
sed -i "s#mv cfg lib tpl vendor /srv#mv cfg lib tpl vendor /srv \&\& sed -i \\'/Content-Security-Policy\\\|X-XSS-Protection\\\|X-Frame-Options\\\|X-Content-Type-Options/d\\' /srv/lib/Controller.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 ${run_volume} &&
podman volume create ${tmp_volume} && podman volume create ${tmp_volume} &&
podman volume create ${varlibnginxtmp_volume} && podman volume create ${varlibnginxtmp_volume} &&
@ -27,7 +24,7 @@ podman run -d --read-only --restart=always --name ${container_name} \
-v ${tmp_volume}:/tmp:Z \ -v ${tmp_volume}:/tmp:Z \
-v ${srvdata_volume}:/srv/data:Z \ -v ${srvdata_volume}:/srv/data:Z \
-v ${varlibnginxtmp_volume}:/var/lib/nginx/tmp:Z \ -v ${varlibnginxtmp_volume}:/var/lib/nginx/tmp:Z \
privatebin-nginx-fpm-alpine && "${privatebin_image}":"${privatebin_version}" &&
( podman logs -f ${container_name} 2>&1 & ) | grep -q 'NOTICE: ready to handle connections' && ( podman logs -f ${container_name} 2>&1 & ) | grep -q 'NOTICE: ready to handle connections' &&
podman stop ${container_name} && podman stop ${container_name} &&
echo Container ${container_name} successfully built and stopped. echo Container ${container_name} successfully built and stopped.

View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
if ! podman image exists ${privatebin_image}:${privatebin_version}; then
git clone -b ${privatebin_version} --depth=1 https://github.com/PrivateBin/docker-nginx-fpm-alpine &&
sed -i "s#mv cfg lib tpl vendor /srv#mv cfg lib tpl vendor /srv \&\& sed -i \\'/Content-Security-Policy\\\|X-XSS-Protection\\\|X-Frame-Options\\\|X-Content-Type-Options/d\\' /srv/lib/Controller.php#" docker-nginx-fpm-alpine/Dockerfile &&
podman build -t "${privatebin_image}":"${privatebin_version}" docker-nginx-fpm-alpine &&
rm -rf docker-nginx-fpm-alpine
else
echo "Image ${privatebin_image}:${privatebin_version} already built"
fi
oci_push_to_registry ${privatebin_image}:${privatebin_version}

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
privatebin_image="git.garbaye.fr/garbaye/privatebin-nginx-fpm-alpine"
privatebin_version='1.4.0-alpine3.16'
container_name='my-privatebin' container_name='my-privatebin'
service_name="container-${container_name}.service" service_name="container-${container_name}.service"
listen_if="${GARBAYE_PRIVATEBIN_ENV_LISTENIF:-127.0.0.1}" listen_if="${GARBAYE_PRIVATEBIN_ENV_LISTENIF:-127.0.0.1}"
@ -9,5 +11,4 @@ varlibnginxtmp_volume='privatebin-var-lib-nginx-tmp'
run_volume='privatebin-run' run_volume='privatebin-run'
tmp_volume='privatebin-tmp' tmp_volume='privatebin-tmp'
nonpersistent_volumes="${varlibnginxtmp_volume} ${run_volume} ${tmp_volume}" nonpersistent_volumes="${varlibnginxtmp_volume} ${run_volume} ${tmp_volume}"
upstream_images='localhost/privatebin-nginx-fpm-alpine docker.io/library/alpine' upstream_images="${privatebin_image} docker.io/library/alpine'
version='1.4.0-alpine3.16'