Создание импортера и добавление скрипта для ожидания доступности контейнера
This commit is contained in:
parent
a0d69ac4fd
commit
c0886cb4ec
2 changed files with 25 additions and 0 deletions
8
manufacturer/container/importer/Dockerfile
Normal file
8
manufacturer/container/importer/Dockerfile
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
FROM alpine:3.21
|
||||||
|
|
||||||
|
# Устанавливаю BASH и CURL для работы с API графаны
|
||||||
|
RUN apk add --no-cache bash curl
|
||||||
|
|
||||||
|
COPY manufacturer/container/importer/scripts/wait_for_it.sh /usr/local/bin/wait-for-it
|
||||||
|
|
||||||
|
RUN chmod +x /usr/local/bin/wait-for-it
|
||||||
17
manufacturer/container/importer/scripts/wait_for_it.sh
Normal file
17
manufacturer/container/importer/scripts/wait_for_it.sh
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
host="$1"
|
||||||
|
shift
|
||||||
|
port="$1"
|
||||||
|
shift
|
||||||
|
cmd="$@"
|
||||||
|
|
||||||
|
until nc -z "$host" "$port"; do
|
||||||
|
>&2 echo "Графана $host:$port недоступна - ждем..."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
>&2 echo "Графана $host:$port доступна - импортирую даш."
|
||||||
|
exec $cmd
|
||||||
Loading…
Add table
Add a link
Reference in a new issue