diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 3496e39f4..e41bc2f99 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -4,22 +4,42 @@ definitions: services: docker: memory: 3072 + steps: + - step: &build-image + name: Build Docker image + image: openjdk:8-jdk-alpine + script: + - docker build -t helloworld -f docker/hello-world/Dockerfile . + - docker save --output tmp-image.docker helloworld + artifacts: + - tmp-image.docker + - step: &push-gcp + name: Push to GCP registry + image: google/cloud-sdk:alpine + script: + - docker load --input ./tmp-image.docker + # Authenticating with the service account key file + - echo $GCLOUD_API_KEYFILE | base64 -d > ./gcloud-api-key.json + - gcloud auth activate-service-account --key-file gcloud-api-key.json + - gcloud config set project $GCLOUD_PROJECT + # # Tag container & push + # - export TAG=$(echo "$BITBUCKET_TAG" | sed -e "s/v//g") + # - export SUFFIX=$([[ ! -z "$TAG" ]] && echo ":$TAG" || echo "") + # - export IMAGE_NAME=gcr.io/my-project/hello-world${SUFFIX} + # - docker tag helloworld ${IMAGE_NAME} + # # Login to google docker hub + # - cat ./gcloud-api-key.json | docker login -u _json_key --password-stdin https://gcr.io + # - docker push ${IMAGE_NAME} pipelines: branches: feature/VRFS-5283: + - step: *push-gcp # - step: # name: Build Container Image # script: # - docker build . # services: # - docker - - step: push-gcp - name: Push to GCP registry - image: google/cloud-sdk:alpine - script: - - echo $GCLOUD_API_KEYFILE | base64 -d > ./gcloud-api-key.json - - gcloud auth activate-service-account --key-file gcloud-api-key.json - - gcloud config set project $GCLOUD_PROJECT develop: - step: name: Build Staging