Skip to content

Instantly share code, notes, and snippets.

@mlabouardy
Created June 14, 2019 19:23
Show Gist options
  • Save mlabouardy/bfdecf296f3d06026c2e6a54ce072a6a to your computer and use it in GitHub Desktop.
Save mlabouardy/bfdecf296f3d06026c2e6a54ce072a6a to your computer and use it in GitHub Desktop.
Continuous Integration for Docker image with Google Cloud Build
steps:
- id: 'run quality test'
name: "golangci/golangci-lint"
args: ["golangci-lint","run"]
- id: 'run unit test'
name: 'gcr.io/cloud-builders/go'
args: ['test', 'app']
env: ['GOPATH=.']
- id: 'run security checks'
name: "securego/gosec"
args: ['app']
env: ['GOPATH=.']
- id: 'build image'
name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'registry.serverlessmovies.com/mlabouardy/app:$SHORT_SHA', '.']
- id: 'login to nexus'
name: 'gcr.io/cloud-builders/docker'
args: ['login', 'registry.serverlessmovies.com', '-u', '${_NEXUS_USERNAME}', '-p', '${_NEXUS_PASSWORD}']
- id: 'tag image'
name: 'gcr.io/cloud-builders/docker'
args: ['tag', 'registry.serverlessmovies.com/mlabouardy/app:$SHORT_SHA', 'registry.serverlessmovies.com/mlabouardy/app:latest']
- id: 'push image'
name: 'gcr.io/cloud-builders/docker'
args: ['push', 'registry.serverlessmovies.com/mlabouardy/app:$SHORT_SHA']
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'registry.serverlessmovies.com/mlabouardy/app:latest']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment