Skip to content

Bmeme OCI Image to build and push container on GCP platform

License

Notifications You must be signed in to change notification settings

bmeme/docker-gcp-image-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maintenance MIT license

GCP IMAGE BUILDER

OCI image, based on the official Docker image and integrated with Google Cloud SDK and Kaniko Executor, currently being used in Bmeme for Continuous Integration and Delivery.

What is contained in the images

  • Google Cloud SDK
  • Docker
  • Kaniko
  • build-base tools
  • python 3.11
  • docker-compose (for backward compatibility)
  • git
  • A script authenticate that wraps authentication tasks against Google Cloud and Google Artifact Registry

Mandatory environments

Variable Name Description
GCP_SERVICE_ACCOUNT The json key of the Google Service Account granted
GCP_REGISTRY_HOST Your Google Cloud Artifact Registry host

Scripts

Authentication

Set mandatory enviroments, then:

# /usr/bin/authenticate

How to use it in a .gitlab-ci.yml pipeline

image: bmeme/gcp-image-builder:latest

stages:
  - build
  - package

variables:
  GCP_PROJECT_ID: my-gcp-project
  GCP_REGISTRY_HOST: europe-docker.pkg.dev #for example

before_script:
  - /usr/bin/authenticate

build:
  stage: build
  script:
    - docker compose up -d

package:
  stage: package
  script:
    - |
      kaniko/executor \
        --dockerfile=/path/to/my/Dockerfile \
        --destination=${GCP_REGISTRY_HOST}/${GCP_PROJECT_ID}/my-repo-name/my-image:1.0.0 \
        --destination=${GCP_REGISTRY_HOST}/${GCP_PROJECT_ID}/my-repo-name/my-image:latest \
        --cache=true \
        --cache-repo=${GCP_REGISTRY_HOST}/${GCP_PROJECT_ID}/my-repo-name/my-image/cache

About

Bmeme OCI Image to build and push container on GCP platform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published