mirror of
https://github.com/valitydev/image-riak-base.git
synced 2024-11-06 02:05:19 +00:00
64 lines
1.7 KiB
Makefile
64 lines
1.7 KiB
Makefile
SERVICE_NAME := embedded-base
|
|
BUILD_IMAGE_TAG := 4536c31941b9c27c134e8daf0fd18848809219c9
|
|
PORTAGE_REF := 50afbf5c38f5bf378a4b3aa7a6068914d27d9003
|
|
BAKKA_REF := 188a683783ed2a8cb4b106d7d844991878db7c52
|
|
UTILS_PATH := build-utils
|
|
REGISTRY := dr2.rbkmoney.com
|
|
|
|
.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/baka-bakka
|
|
REPOS_TARGET = $(patsubst %,$(IMAGES_SHARED)/%/.git,$(REPOS))
|
|
|
|
$(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_TARGET)
|
|
|
|
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
|
|
|