Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aren/vx 122 build docker #13

Merged
merged 4 commits into from
Jun 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
language: go

sudo: required

services:
- mongodb
- docker

go:
- "1.10.x"
Expand All @@ -18,14 +21,28 @@ cache:
- vendor/gopkg.in
- vendor/k8s.io

install:
before_install:
- go get -u github.com/kardianos/govendor

install:
- make pre-build

script:
- make build
- make test
- make src.test-coverage
- docker build --tag sdnvortex/vortex --file ./dockerfiles/Dockerfile .

before_deploy:
- echo $DOCKER_HUB_PASSWORD | docker login -u $DOCKER_HUB_USER --password-stdin

deploy:
provider: script
script:
docker tag sdnvortex/vortex sdnvortex/vortex:develop
docker push sdnvortex/vortex:develop
on:
branch: develop

after_success:
- cp build/src/coverage.txt coverage.txt
Expand Down
28 changes: 28 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,33 @@ pipeline {
}
}
}
stage("Build Image"){
steps {
script {
dir ("src/github.com/linkernetworks/vortex") {
docker.build("sdnvortex/vortex" , "--file ./dockerfiles/Dockerfile .")
}
}
}
}
stage("Push Image"){
when {
branch 'develop'
}
steps {
script {
withCredentials([
usernamePassword(
credentialsId: 'eb1d8dd2-afd2-49d3-bbef-605de4f664d2',
usernameVariable: 'DOCKER_USER',
passwordVariable: 'DOCKER_PASS'
)
]) {
sh 'echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin'
}
docker.image("sdnvortex/vortex").push("develop")
}
}
}
}
}
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ GO = go
GO_VENDOR = govendor
MKDIR_P = mkdir -p

## For docker
DOCKER_REGISTRY = sdnvortex
IMAGE_TAG = latest
PROJECT = vortex
################################################

.PHONY: all
Expand Down Expand Up @@ -71,5 +67,7 @@ check-govendor:
@[ "`which $(GO_VENDOR)`" != "" ] || (echo "$(GO_VENDOR) is missing"; false)

## dockerfiles/ ########################################
docker.build:
docker build --tag $(DOCKER_REGISTRY)/$(PROJECT):$(IMAGE_TAG) -f ./dockerfiles/Dockerfile .

.PHONY: dockerfiles.build
dockerfiles.build:
docker build --tag sdnvortex/vortex:latest --file ./dockerfiles/Dockerfile .