This repository has been archived on 2024-07-25. You can view files and clone it, but cannot push or open issues or pull requests.
docker_stack/entrypoint.sh
Dmitriy Pleshevskiy 4c632b99f8
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
add support of CI_REPO_NAME
2023-03-15 12:32:36 +03:00

27 lines
525 B
Bash

#!/bin/sh
set -e
registry="${PLUGIN_REGISTRY:-$ORG_REGISTRY}"
stack_name="${PLUGIN_NAME:-${DRONE_REPO_NAME:-${CI_REPO_NAME}}}"
compose_file="${PLUGIN_COMPOSE_FILE_PATH:-docker-compose.yml}"
set -x
if [ -n "${registry}" ]; then
auth_flags=--with-registry-auth
fi
if [ -n "$PLUGIN_PASSWORD" ]; then
echo -n "$PLUGIN_PASSWORD" | \
docker login \
-u "$PLUGIN_USERNAME" \
--password-stdin \
${registry}
fi
docker stack deploy
$auth_flags \
--compose-file "${compose_file}" \
"${stack_name}"