I have the following circle file…
machine:
post:
# GCloud setup
- sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update --version 157.0.0
- sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update --version 157.0.0 kubectl
- echo $GCLOUD_SERVICE_KEY
- echo $GCLOUD_SERVICE_KEY | base64 --decode -i > ${HOME}/gcloud-service-key.json
- cat ${HOME}/gcloud-service-key.json
- sudo /opt/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
- sudo /opt/google-cloud-sdk/bin/gcloud config set project $GCLOUD_PROJECT_NAME
- sudo /opt/google-cloud-sdk/bin/gcloud --quiet config set container/cluster $GCLOUD_CLUSTER_NAME
- sudo /opt/google-cloud-sdk/bin/gcloud config set compute/zone ${CLOUDSDK_COMPUTE_ZONE}
- sudo /opt/google-cloud-sdk/bin/gcloud --quiet container clusters get-credentials $GCLOUD_CLUSTER_NAME
# Permissions fix for kubectl - https://circleci.com/docs/continuous-deployment-with-google-container-engine/
- sudo chown -R ubuntu:ubuntu /home/ubuntu/.kube
services:
- docker
environment:
GCLOUD_PROJECT_NAME: tabb-168314
GCLOUD_CLUSTER_NAME: dev
CLOUDSDK_COMPUTE_ZONE: europe-west1-b
DOCKER_TAG_PREFIX: "eu.gcr.io/$GCLOUD_PROJECT_NAME/ui"
DOCKER_TAG: "$DOCKER_TAG_PREFIX:$CIRCLE_SHA1"
NODE_ENV: production
dependencies:
cache_directories:
- "node_modules"
compile:
override:
- echo $DOCKER_TAG
- if [ $CIRCLE_BRANCH = 'master' ]; then cp ./src/env.production ./src/env.js; fi
- if [ $CIRLCE_BRANCH = 'develop' ]; then cp ./src/env.staging ./src/env.js; fi
- if [ $CIRLCE_BRANCH = 'story/72-dockerise-and-setup-circleci' ]; then cp ./src/env.staging ./src/env.js; fi
- free -m
- npm run deploy:prod:
timeout: 9000
- docker build -t $DOCKER_TAG .
test:
override:
- npm test
deployment:
production:
branch: ['master']
commands:
- docker tag "$DOCKER_TAG" "$DOCKER_TAG_PREFIX:latest"
- sudo /opt/google-cloud-sdk/bin/gcloud docker -- push $DOCKER_TAG
- sudo /opt/google-cloud-sdk/bin/gcloud docker -- push "$DOCKER_TAG_PREFIX:latest"
- kubectl --namespace=production patch deployment ui -p '{"spec":{"template":{"spec":{"containers":[{"name":"ui","image":"'"$DOCKER_TAG"'"}]}}}}'
staging:
branch: ['develop', 'development', 'story/72-dockerise-and-setup-circleci']
commands:
- docker tag "$DOCKER_TAG" "$DOCKER_TAG_PREFIX:develop"
- sudo /opt/google-cloud-sdk/bin/gcloud docker -- push $DOCKER_TAG
- sudo /opt/google-cloud-sdk/bin/gcloud docker -- push "$DOCKER_TAG_PREFIX:develop"
- kubectl --namespace=staging patch deployment ui -p '{"spec":{"template":{"spec":{"containers":[{"name":"ui","image":"'"$DOCKER_TAG"'"}]}}}}'
When the build hits the compile stage, more specifically the $ npm run deploy:prod
command, it basically throws and exit code 1 without any errors? Am I hitting some kind of memory limit? The command basically runs a webpack bundle/build command.
Cheers,
Ewan