add circleci config and update makefile for ci

This commit is contained in:
Jeffrey Paul 2019-11-12 21:24:58 -08:00
parent 3b378e2f3d
commit d8f1665dc6
2 changed files with 35 additions and 4 deletions

11
.circleci/config.yml Normal file
View File

@ -0,0 +1,11 @@
version: 2
jobs:
build:
machine: true
steps:
- checkout
- run: make dist
- store_artifacts:
path: output
- run: echo "$DOCKER_PASS" | docker login --username $DOCKER_USER --password-stdin
- run: make ci-upload-images

View File

@ -1,7 +1,27 @@
default: build
APPNAME := docker-linux-vm
IMAGENAME := sneak/$(APPNAME)
BUILDTIMEFILENAME := $(shell date -u '+%Y%m%d-%H%M%SZ')
build:
docker build -t sneak/docker-linux-vm .
default: build-docker-image
run:
docker run -ti sneak/docker-linux-vm
docker run -ti $(IMAGENAME)
dist: build-docker-image
-mkdir -p ./output
docker save $(IMAGENAME) | bzip2 > output/$(BUILDTIMEFILENAME).$(APPNAME).tbz2
hub: upload-docker-image
build-docker-image:
docker build -t $(IMAGENAME) .
upload-docker-image: build-docker-image
docker tag $(IMAGENAME) $(IMAGENAME):$(BUILDTIMETAG)
docker push $(IMAGENAME):$(BUILDTIMETAG)
ci-upload-images:
docker tag $(IMAGENAME) $(IMAGENAME):$(CIRCLE_SHA1)
docker tag $(IMAGENAME) $(IMAGENAME):$(CIRCLE_BRANCH)
docker push $(IMAGENAME):$(CIRCLE_SHA1)
docker push $(IMAGENAME):$(CIRCLE_BRANCH)