dk: support limité de podman
This commit is contained in:
parent
5457228b02
commit
4fdd23c8eb
56
dk
56
dk
|
@ -276,7 +276,7 @@ VARIABLES de update-apps.conf
|
|||
COMPOSER_ACTION
|
||||
vaut 'install' par défaut. Indique ce qu'il faut faire pour un projet de
|
||||
type 'composer' après avoir lancé les commandes de AFTER_UPDATE. Les
|
||||
directives supporées sont 'install', 'update' et 'none'
|
||||
directives supportées sont 'install', 'update' et 'none'
|
||||
|
||||
FONCTIONS de update-apps.conf
|
||||
sqlmig [DESTDIR [SRCDIR [NOFIX]]]
|
||||
|
@ -789,7 +789,7 @@ function default_docker_build() {
|
|||
for tag in "${TAGS[@]}"; do
|
||||
replace_build_args+=(-t "$NAME:$tag")
|
||||
done
|
||||
${FAKE:+qvals} docker build \
|
||||
${FAKE:+qvals} "$DOCKER" build \
|
||||
${NO_CACHE:+--no-cache} \
|
||||
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||
"${replace_build_args[@]}" "${build_args[@]}" \
|
||||
|
@ -829,7 +829,7 @@ function default_compose_push() {
|
|||
"$@"
|
||||
}
|
||||
function default_docker_push() {
|
||||
${FAKE:+qvals} docker push \
|
||||
${FAKE:+qvals} "$DOCKER" push \
|
||||
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||
"$@"
|
||||
}
|
||||
|
@ -865,7 +865,7 @@ function default_compose_up() {
|
|||
"${replace_user_args[@]}" "${user_args[@]}" "$@"
|
||||
}
|
||||
function default_docker_up() {
|
||||
${FAKE:+qvals} docker run \
|
||||
${FAKE:+qvals} "$DOCKER" run \
|
||||
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||
"${replace_run_args[@]}" "${run_args[@]}" \
|
||||
"$NAME" \
|
||||
|
@ -897,7 +897,7 @@ function default_compose_stop() {
|
|||
"$@"
|
||||
}
|
||||
function default_docker_stop() {
|
||||
${FAKE:+qvals} docker container stop \
|
||||
${FAKE:+qvals} "$DOCKER" container stop \
|
||||
"${replace_stop_args[@]}" "${stop_args[@]}" \
|
||||
"$container_name" "$@"
|
||||
}
|
||||
|
@ -924,7 +924,7 @@ function default_compose_logs() {
|
|||
"$@"
|
||||
}
|
||||
function default_docker_logs() {
|
||||
${FAKE:+qvals} docker logs \
|
||||
${FAKE:+qvals} "$DOCKER" logs \
|
||||
"${replace_logs_args[@]}" "${logs_args[@]}" \
|
||||
"$container_name" "$@"
|
||||
}
|
||||
|
@ -954,11 +954,11 @@ function default_compose_down() {
|
|||
}
|
||||
function default_docker_down() {
|
||||
estep "stop"
|
||||
${FAKE:+qvals} docker container stop \
|
||||
${FAKE:+qvals} "$DOCKER" container stop \
|
||||
"${replace_down_args[@]}" "${down_args[@]}" \
|
||||
"$container_name" "$@"
|
||||
estep "rm"
|
||||
${FAKE:+qvals} docker container rm \
|
||||
${FAKE:+qvals} "$DOCKER" container rm \
|
||||
"${replace_rm_args[@]}" "${rm_args[@]}" \
|
||||
"$container_name"
|
||||
}
|
||||
|
@ -986,7 +986,7 @@ function default_compose_run() {
|
|||
"${replace_user_args[@]}" "${user_args[@]}" "$@"
|
||||
}
|
||||
function default_docker_run() {
|
||||
${FAKE:+qvals} docker run \
|
||||
${FAKE:+qvals} "$DOCKER" run \
|
||||
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||
"${replace_run_args[@]}" "${run_args[@]}" \
|
||||
"$NAME" \
|
||||
|
@ -1048,7 +1048,7 @@ function default_compose_exec() {
|
|||
"$@"
|
||||
}
|
||||
function default_docker_exec() {
|
||||
${FAKE:+qvals} docker container exec \
|
||||
${FAKE:+qvals} "$DOCKER" container exec \
|
||||
"${replace_exec_args[@]}" "${exec_args[@]}" \
|
||||
"$container_name" "$@"
|
||||
}
|
||||
|
@ -1069,7 +1069,7 @@ function auto_exec() {
|
|||
}
|
||||
|
||||
function default_docker_deploy() {
|
||||
${FAKE:+qvals} docker \
|
||||
${FAKE:+qvals} "$DOCKER" \
|
||||
stack deploy \
|
||||
"${replace_deploy_args[@]}" "${deploy_args[@]}" \
|
||||
"$container_name" "$@"
|
||||
|
@ -1089,7 +1089,7 @@ function auto_deploy() {
|
|||
}
|
||||
|
||||
function default_docker_service() {
|
||||
${FAKE:+qvals} docker service "$@"
|
||||
${FAKE:+qvals} "$DOCKER" service "$@"
|
||||
}
|
||||
function docker_service() { default_docker_service "$@"; }
|
||||
function auto_service() {
|
||||
|
@ -1137,12 +1137,12 @@ function default_compose_show_ip() {
|
|||
else
|
||||
setx -a cids="${cmd[@]}" 2>/dev/null
|
||||
for cid in "${cids[@]}"; do
|
||||
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$cid"
|
||||
"$DOCKER" inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$cid"
|
||||
done
|
||||
fi
|
||||
}
|
||||
function default_docker_show_ip() {
|
||||
${FAKE:+qvals} docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' \
|
||||
${FAKE:+qvals} "$DOCKER" inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' \
|
||||
"${replace_show_ip_args[@]}" "${show_ip_args[@]}" \
|
||||
"$container_name" "$@"
|
||||
}
|
||||
|
@ -1180,7 +1180,7 @@ function default_compose_systemd_unit() {
|
|||
setx stopcmd=qvals "$docker_compose" down
|
||||
}
|
||||
function default_docker_systemd_unit() {
|
||||
local docker="$(which docker 2>/dev/null)"
|
||||
local docker="$(which "$DOCKER" 2>/dev/null)"
|
||||
if [ -z "$docker" ]; then
|
||||
if [ -x /usr/bin/docker ]; then
|
||||
docker=/usr/bin/docker
|
||||
|
@ -1347,15 +1347,15 @@ fi
|
|||
if [ -z "$dkid" ]; then
|
||||
estep "Création du container $container_name avec l'image $COMPOSER_IMAGE"
|
||||
cmd=(
|
||||
docker create -it --name "${container_name}_ct"
|
||||
"$DOCKER" create -it --name "${container_name}_ct"
|
||||
"${basecmd[@]}"
|
||||
"$COMPOSER_IMAGE"
|
||||
bash -c "$setupscript"
|
||||
)
|
||||
setx dkid="${cmd[@]}" || return 1
|
||||
docker container start -ai "$dkid" || return 1
|
||||
docker container commit "$dkid" "${container_name}_image" || return 1
|
||||
docker container rm "$dkid" || return 1
|
||||
"$DOCKER" container start -ai "$dkid" || return 1
|
||||
"$DOCKER" container commit "$dkid" "${container_name}_image" || return 1
|
||||
"$DOCKER" container rm "$dkid" || return 1
|
||||
fi
|
||||
|
||||
# prendre comme image le container créé
|
||||
|
@ -1363,7 +1363,7 @@ fi
|
|||
fi
|
||||
|
||||
cmd=(
|
||||
docker run -it --rm
|
||||
"$DOCKER" run -it --rm
|
||||
"${basecmd[@]}"
|
||||
"$COMPOSER_IMAGE"
|
||||
bash -c "$runscript"
|
||||
|
@ -1412,6 +1412,12 @@ function auto_composer() {
|
|||
|
||||
################################################################################
|
||||
|
||||
# support limité docker / podman
|
||||
if progexists docker; then DOCKER=docker
|
||||
elif progexists podman; then DOCKER=podman
|
||||
else DOCKER=docker
|
||||
fi
|
||||
|
||||
DEFAULT_PROFILE=devel
|
||||
# pour le moment ne pas lancer composer dans un container par défaut
|
||||
DEFAULT_COMPOSER_IMAGE=none #docker.univ-reunion.fr/image/utils-icmycas-php-apache:d9
|
||||
|
@ -1697,7 +1703,7 @@ while [ $# -gt 0 ]; do
|
|||
;;
|
||||
ps)
|
||||
pscmd=(
|
||||
docker container ps -a
|
||||
"$DOCKER" container ps -a
|
||||
--format "table {{.ID}}\t{{.Image}}\t{{.Names}}\t{{.Status}}\t{{.RunningFor}}\t{{.Ports}}"
|
||||
)
|
||||
filtercmd=(cat)
|
||||
|
@ -1790,7 +1796,7 @@ NR == 1 { print; next }
|
|||
echo "$all"
|
||||
ask_yesno "Etes-vous sûr de vouloir mettre à jour ces images?" O || die
|
||||
for image in "${images[@]}"; do
|
||||
docker pull "$image" || die
|
||||
"$DOCKER" pull "$image" || die
|
||||
done
|
||||
fi
|
||||
;;
|
||||
|
@ -1827,12 +1833,12 @@ NR == 1 { print; next }
|
|||
if [ ${#images[*]} -gt 0 ]; then
|
||||
echo "$all"
|
||||
ask_yesno "Etes-vous sûr de vouloir supprimer ces images?" || die
|
||||
docker image rm ${FORCE:+--force} "${images[@]}" || die
|
||||
"$DOCKER" image rm ${FORCE:+--force} "${images[@]}" || die
|
||||
fi
|
||||
;;
|
||||
X|prune)
|
||||
docker container prune -f || die
|
||||
docker image prune -f || die
|
||||
"$DOCKER" container prune -f || die
|
||||
"$DOCKER" image prune -f || die
|
||||
;;
|
||||
composer|c|ci|cu|cs)
|
||||
build_set_options "$update_apps_mode" "$update_apps_origin" "$update_apps_branch"
|
||||
|
|
Loading…
Reference in New Issue