Add modified Makefile

This commit is contained in:
Anton Malinskiy
2018-11-20 14:03:42 +07:00
parent 22059da438
commit 5e4f84f25c
3 changed files with 20 additions and 4 deletions

View File

@@ -27,6 +27,11 @@ lint: generate
$(MAKE) -C build/$$version lint; \
done
snapshot: generate build
for version in $(VERSIONS); do \
$(MAKE) -C build/$$version snapshot; \
done
tag: generate
for version in $(VERSIONS); do \
$(MAKE) -C build/$$version tag; \

View File

@@ -9,20 +9,31 @@ GIT_TAG=$(QNAME):$(VCS_REF)
BUILD_TAG=$(QNAME):$(IMAGE_VERSION)
LATEST_TAG=$(QNAME):latest
SNAPSHOT_IMAGE_NAME=docker-emulator-snapshot-{{ platform }}
SNAPSHOT_QNAME=$(PROXY)$(OWNER)/$(SNAPSHOT_IMAGE_NAME)
SNAPSHOT_GIT_TAG=$(SNAPSHOT_QNAME):$(VCS_REF)
SNAPSHOT_BUILD_TAG=$(SNAPSHOT_QNAME):$(IMAGE_VERSION)
SNAPSHOT_LATEST_TAG=$(SNAPSHOT_QNAME):latest
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
build:
docker build \
--build-arg VCS_REF=$(VCS_REF) \
--build-arg IMAGE_VERSION=$(IMAGE_VERSION) \
-t $(GIT_TAG) $(ROOT_DIR)
-t $(LATEST_TAG) $(ROOT_DIR)
snapshot:
bash $(ROOT_DIR)/take_snapshot.sh
lint:
docker run -it --rm -v "$(ROOT_DIR)/Dockerfile:/Dockerfile:ro" redcoolbeans/dockerlint
tag:
docker tag $(GIT_TAG) $(BUILD_TAG)
docker tag $(GIT_TAG) $(LATEST_TAG)
docker tag $(LATEST_TAG) $(BUILD_TAG)
docker tag $(LATEST_TAG) $(GIT_TAG)
docker tag $(SNAPSHOT_LATEST_TAG) $(SNAPSHOT_BUILD_TAG)
docker tag $(SNAPSHOT_LATEST_TAG) $(SNAPSHOT_GIT_TAG)
push:
docker push $(GIT_TAG)

View File

@@ -10,5 +10,5 @@ docker cp snapshot.sh emulator:/snapshot.sh
docker cp snapshot.expect emulator:/snapshot.expect
docker exec -t emulator bash -c "bash /snapshot.sh; exit"
echo "Creating new image"
docker commit -m "Snapshot!" --change "CMD [\"/start.sh\"]" emulator agoda/docker-emulator-{{ platform }}-snapshot
docker commit -m "Snapshot!" --change "CMD [\"/start.sh\"]" emulator agoda/docker-emulator-snapshot-{{ platform }}
docker rm -f emulator