add circleci config and update makefile for ci

master
Jeffrey Paul 3 years ago
parent 3b378e2f3d
commit d8f1665dc6
  1. 11
      .circleci/config.yml
  2. 28
      Makefile

@ -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

@ -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)