Browse Source

add circleci config and update makefile for ci

master
Jeffrey Paul 1 year ago
parent
commit
d8f1665dc6
2 changed files with 35 additions and 4 deletions
  1. +11
    -0
      .circleci/config.yml
  2. +24
    -4
      Makefile

+ 11
- 0
.circleci/config.yml 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

+ 24
- 4
Makefile 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)