mirror of
https://github.com/valitydev/image-riak-base.git
synced 2024-11-06 02:05:19 +00:00
60 lines
1.6 KiB
Makefile
60 lines
1.6 KiB
Makefile
UTILS_PATH := build-utils
|
|
SERVICE_NAME := riak-base
|
|
BUILD_IMAGE_TAG := 4536c31941b9c27c134e8daf0fd18848809219c9
|
|
PORTAGE_REF := 50afbf5c38f5bf378a4b3aa7a6068914d27d9003
|
|
OVERLAYS_RBKMONEY_REF := a00a337bf6e6b566b545015abcf68a2daabd4e7c
|
|
|
|
.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) riak
|
|
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 -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
|