kopia lustrzana https://github.com/J-Rios/TLG_JoinCaptchaBot
Fix invalid default language manage in docker build.
rodzic
f66d2bae62
commit
3ae7d5b86f
|
@ -1,14 +1,28 @@
|
|||
NAME=captcha-bot
|
||||
BOT_LANG ?= "EN"
|
||||
NAME = captcha-bot
|
||||
BOT_LANG ?= EN
|
||||
SUPPORTED_LANGUAGES = EN ES CA GL PT_BR ZH_CN
|
||||
|
||||
# Check if Bot token has been provided
|
||||
ifndef BOT_TOKEN
|
||||
$(error BOT_TOKEN is not set. Use make -e BOT_TOKEN=<your_bot_token>.)
|
||||
$(error BOT_TOKEN is not set. Use make -e BOT_TOKEN=<your_bot_token>.)
|
||||
endif
|
||||
|
||||
# Set bot language argument to uppercases
|
||||
BOT_LANG_UPP = $(shell echo $(BOT_LANG) | tr a-z A-Z)
|
||||
|
||||
# Check if it is a supported language argument
|
||||
VALID_LANG = $(foreach lang, $(SUPPORTED_LANGUAGES),$(if $(findstring $(lang), $(BOT_LANG_UPP)),true))
|
||||
ifneq ($(strip $(VALID_LANG)), true)
|
||||
$(info )
|
||||
$(info Provided default language: $(BOT_LANG_UPP))
|
||||
$(info Languages supported: $(SUPPORTED_LANGUAGES))
|
||||
$(error Invalid default language provided)
|
||||
endif
|
||||
|
||||
build:
|
||||
docker build -t "${NAME}" --build-arg BOT_TOKEN="${BOT_TOKEN}" --build-arg BOT_LANG="${BOT_LANG}" .
|
||||
docker build -t "${NAME}" --build-arg BOT_TOKEN="${BOT_TOKEN}" --build-arg BOT_LANG="${BOT_LANG_UPP}" .
|
||||
|
||||
force:
|
||||
docker build -t "${NAME}" --no-cache --build-arg BOT_TOKEN="${BOT_TOKEN}" --build-arg BOT_LANG="${BOT_LANG}" .
|
||||
docker build -t "${NAME}" --no-cache --build-arg BOT_TOKEN="${BOT_TOKEN}" --build-arg BOT_LANG="${BOT_LANG_UPP}" .
|
||||
|
||||
.PHONY: build force
|
||||
|
|
Ładowanie…
Reference in New Issue