File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 3131
3232 - run :
3333 name : Run Tests
34- command : carton exec prove -lv
34+ command : carton exec prove -lv
35+
36+ - setup_remote_docker
37+
38+ - run :
39+ name : Install Docker client
40+ when : on_success
41+ command : |
42+ if [ "${CIRCLE_BRANCH}" == "circle-ci" ]; then
43+ set -x
44+ VER="17.03.0-ce"
45+ curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz
46+ tar -xz -C /tmp -f /tmp/docker-$VER.tgz
47+ mv /tmp/docker/* /usr/bin
48+ else
49+ echo "Not master branch so no docker required"
50+ fi
51+
52+ - run :
53+ name : Build and Push Docker Image
54+ when : on_success
55+ shell : /bin/bash
56+ command : |
57+ if [ "${CIRCLE_BRANCH}" == "circle-ci" ]; then
58+ docker login -u ${DOCKER_LOGIN} -p ${DOCKER_PASSWORD}
59+ make push deploy_ci
60+ else
61+ echo "Not master branch, So no push to DockerHub"
62+ fi
Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ RELEASE_VERSION ?= latest
1010LOCAL_IMAGE := $(NAME ) :$(RELEASE_VERSION )
1111REMOTE_IMAGE := $(NAMESPACE ) /$(LOCAL_IMAGE )
1212
13+ CIRLE_SHA1 ?= ''
14+ REMOTE_IMAGE_CI := $(NAMESPACE ) /$(NAME ) :$(CIRCLE_SHA1 )
15+
1316# Environment General Settings
1417ENVIRONMENT ?= devel
1518SECRETS_URL ?= 'https://www.dropbox.com/s/p9x87ffn19rdr0c/secrets.mk.gpg'
4043
4144all : test update # # Test, Build and Push Docker Image to the Registry
4245update : build push # # Build and Push Docker Image to the Registry
46+ deploy_ci : build push_ci
4347
4448build : # # Build docker image with name LOCAL_IMAGE (NAME:RELEASE_VERSION).
4549 docker build -f $(THISDIR_PATH ) /Dockerfile -t $(LOCAL_IMAGE ) $(PROJECT_PATH )
@@ -92,6 +96,10 @@ tag: ## Tag IMAGE_NAME
9296push : tag # # Push to the docker registry
9397 docker push $(REMOTE_IMAGE )
9498
99+ push_ci :
100+ docker tag $(LOCAL_IMAGE ) $(REMOTE_IMAGE_CI )
101+ docker push $(REMOTE_IMAGE_CI )
102+
95103pull : # # Pull the docker from the Registry
96104 docker pull $(REMOTE_IMAGE )
97105
You can’t perform that action at this time.
0 commit comments