swarm-deploy-helper is a tool to help build and deploy containerized applications into Docker Swarm using GitLab CI.
Example of .gitlab-ci.yml
to build and release container image:
include:
- remote: 'https://raw.githubusercontent.com/bborysenko/swarm-deploy-helper/master/templates/docker.gitlab-ci.yml'
stages:
- build
- release
build:docker:
extends: .docker:image:build
release:docker:
extends: .docker:image:release
To be able to pull/push container images from/to Google Container Registry you have to create a service account and setup Gitlab CI environment variables.
- Go to IAM > Service Accounts and create one with Storage Admin role.
- Download a file contains the JSON private key for service account.
- In Gitlab create project or group level environment variables -
GOOGLE_PROJECT
- with name of Google Cloud project andGOOGLE_SERVICE_KEY
with contents of service account private key which you downloaded previously.