image-riak-base/Makefile
Sergey Yelin dd49c98c71
ED-216: Upgrade riak to 3.0.9 (#23)
* Latest OTP/22: =dev-lang/erlang-22.3.4.21::rbkmoney
* Update PORTAGE_REF
* remove systemtap, not needed anymore
Co-authored-by: Grigory Antsiferov <azr@bakka.su>
2021-11-22 16:47:39 +03:00

65 lines
1.8 KiB
Makefile

UTILS_PATH := build-utils
SERVICE_NAME := riak-base
BUILD_IMAGE_TAG := 25c031edd46040a8745334570940a0f0b2154c5c
PORTAGE_REF := d9257374c6dc66cf541887f5a3273c4459a0c844
OVERLAYS_RBKMONEY_REF := 6740592c44b3312f492fbd765c7338b5c4347ff0
RIAK_VERSION := 3.0.9
RIAK_VERSION_HASH := d5d397f1694ad098081fdc466fc58d3f4c58345e
.PHONY: $(SERVICE_NAME) push submodules repos
$(SERVICE_NAME): .state
-include $(UTILS_PATH)/make_lib/utils_repo.mk
COMMIT := $(shell git rev-parse HEAD)
TAG := $(COMMIT)
rev = $(shell git rev-parse --abbrev-ref HEAD)
BRANCH := $(shell \
if [[ "${rev}" != "HEAD" ]]; then \
echo "${rev}" ; \
elif [ -n "${BRANCH_NAME}" ]; then \
echo "${BRANCH_NAME}"; \
else \
echo `git name-rev --name-only HEAD`; \
fi)
SUBMODULES = $(UTILS_PATH)
SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES))
REPOS = portage overlays/rbkmoney
$(SUBTARGETS):
$(eval SSH_PRIVKEY := $(shell echo $(GITHUB_PRIVKEY) | sed -e 's|%|%%|g'))
GIT_SSH_COMMAND="$(shell which ssh) -o StrictHostKeyChecking=no -o User=git `[ -n '$(SSH_PRIVKEY)' ] && echo -o IdentityFile='$(SSH_PRIVKEY)'`" \
git submodule update --init $(subst /,,$(basename $@))
touch $@
submodules: $(SUBTARGETS)
repos: $(REPOS)
Dockerfile: Dockerfile.sh
REGISTRY=$(REGISTRY) ORG_NAME=$(ORG_NAME) \
BUILD_IMAGE_TAG=$(BUILD_IMAGE_TAG) \
COMMIT=$(COMMIT) BRANCH=$(BRANCH) \
./Dockerfile.sh > Dockerfile
.state: Dockerfile $(REPOS)
docker build --build-arg riak_version=$(RIAK_VERSION) \
--build-arg riak_version_hash=$(RIAK_VERSION_HASH) \
-t $(SERVICE_IMAGE_NAME):$(TAG) .
echo $(TAG) > $@
test:
$(DOCKER) run "$(SERVICE_IMAGE_NAME):$(shell cat .state)" \
bash -c "bash --version; ip addr"
push:
$(DOCKER) push "$(SERVICE_IMAGE_NAME):$(shell cat .state)"
clean:
test -f .state \
&& $(DOCKER) rmi -f "$(SERVICE_IMAGE_NAME):$(shell cat .state)" \
&& rm .state \
&& rm -rf portage-root