@@ -43,15 +43,12 @@ if [ -f "${registries}" ]; then
4343 cat " ${registries} " > /etc/containers/registries.conf
4444fi
4545
46- podman system service \
47- --log-level " ${log_level} " \
48- --time 0 tcp:0.0.0.0:${DOCKER_PORT} &
46+ podman system service --time 0 tcp:0.0.0.0:${DOCKER_PORT} &
4947
5048waiting_process podman
5149if [[ -n " ${TAR_PATH} " ]]; then
5250 get_object
53- tar -xzf /tmp/app.tgz -C /app/ && \
54- unset TAR_PATH
51+ tar -xzf /tmp/app.tgz -C /app/ && unset TAR_PATH
5552fi
5653
5754pack_builder=" docker.io/drycc/buildpacks:20"
@@ -65,55 +62,68 @@ if [[ "${DRYCC_REGISTRY_LOCATION}" == "off-cluster" ]] ; then
6562 podman login \
6663 --username " ${DRYCC_REGISTRY_USERNAME} " \
6764 --password " ${DRYCC_REGISTRY_PASSWORD} " \
68- " ${DRYCC_REGISTRY_HOSTNAME} " --tls-verify=false \
69- > /dev/null
65+ " ${DRYCC_REGISTRY_HOSTNAME} " \
66+ --tls-verify=false > /dev/null
7067else
7168 # Start registry proxy
7269 registry=" ${DRYCC_REGISTRY_PROXY_HOST} :${DRYCC_REGISTRY_PROXY_PORT} "
70+ if [[ ${log_level} == " debug" ]] ; then
71+ output=" /dev/stdout"
72+ else
73+ output=" /dev/null"
74+ fi
7375 caddy reverse-proxy \
7476 --from " :${DRYCC_REGISTRY_PROXY_PORT} " \
7577 --to " ${DRYCC_REGISTRY_SERVICE_HOST} :${DRYCC_REGISTRY_SERVICE_PORT} " \
76- > " $( [ " ${log_level} " == " debug " ] && echo " /dev/stdout " || echo " /dev/null " ) " 2>&1 &
78+ > " ${output} " 2>&1 &
7779 waiting_process caddy
7880 podman login \
7981 --username drycc \
8082 --password drycc \
81- --tls-verify=false \
82- " ${registry} " \
83+ --tls-verify=false " ${registry} " \
8384 > /dev/null
8485fi
8586
8687# Get image name and image tag
8788image_name=$( echo " ${IMG_NAME} " | awk -F ' :' ' {print $1}' )
8889image_tag=$( echo " ${IMG_NAME} " | awk -F ' :' ' {print $2}' )
8990image_repo=" ${registry} /${image_name} :${image_tag} "
90- image_cache_repo=" ${registry} /${image_name} :latest"
91+ image_cache_repo=" ${registry} /${image_name} :cache"
92+ image_latest_repo=" ${registry} /${image_name} :latest"
9193
92- # Pull latest image as cache
93- {
94- echo " ---> Reusing cache"
95- podman pull " ${image_cache_repo} " --tls-verify=false > /dev/null 2>&1
96- } || {
97- echo " ---> Cache not found"
98- }
9994# Building
100- export LIFECYCLE_IMAGE=docker.io/buildpacksio/lifecycle:0.12.0-rc.1
10195if [[ " ${DRYCC_STACK} " == " container" ]] ; then
10296 echo " ---> Building container"
103- podman build -t " ${image_cache_repo} " --network host .
97+ if [[ $log_level == " debug" ]] ; then
98+ podman build --tag" ${image_repo} " --network host .
99+ podman push " ${image_repo} " --tls-verify=false
100+ else
101+ podman build --quiet --tag " ${image_repo} " --network host .
102+ podman push " ${image_repo} " --quiet --tls-verify=false
103+ fi
104104else
105105 echo " ---> Building pack"
106106 echo " ---> Using builder ${pack_builder} "
107- pack build " ${image_cache_repo} " \
108- --builder " ${pack_builder} " \
109- --docker-host " ${DOCKER_HOST} " \
110- --lifecycle-image " ${LIFECYCLE_IMAGE} " \
111- --trust-builder \
112- --network host
113- fi
114-
115- # Publish image
116- echo " ---> Publishing image"
117- podman tag " ${image_cache_repo} " " ${image_repo} "
118- podman push " ${image_cache_repo} " --tls-verify=false
119- podman push " ${image_repo} " --tls-verify=false
107+ if [[ $log_level == " debug" ]] ; then
108+ pack build " ${image_repo} " \
109+ --builder " ${pack_builder} " \
110+ --docker-host " ${DOCKER_HOST} " \
111+ --previous-image " ${image_latest_repo} " \
112+ --trust-builder \
113+ --publish \
114+ --cache-image " ${image_cache_repo} " \
115+ --tag " ${image_latest_repo} " \
116+ --network host \
117+ --verbose
118+ else
119+ pack build " ${image_repo} " \
120+ --builder " ${pack_builder} " \
121+ --docker-host " ${DOCKER_HOST} " \
122+ --previous-image " ${image_latest_repo} " \
123+ --trust-builder \
124+ --publish \
125+ --cache-image " ${image_cache_repo} " \
126+ --tag " ${image_latest_repo} " \
127+ --network host
128+ fi
129+ fi
0 commit comments