Skip to content

Instantly share code, notes, and snippets.

@johnshumon
Created November 13, 2019 16:03
Show Gist options
  • Save johnshumon/616ffdea88da2e716e36187d887b0ea0 to your computer and use it in GitHub Desktop.
Save johnshumon/616ffdea88da2e716e36187d887b0ea0 to your computer and use it in GitHub Desktop.
image: google/cloud-sdk:alpine
deploy_in_appengine:
stage: deploy
environment:
name: production
only:
- develop
script:
- echo $SERVICE_ACCOUNT > /tmp/$SERVICE_ACCOUNT_KEY.json
- gcloud auth activate-service-account --key-file /tmp/$SERVICE_ACCOUNT_KEY.json
# update and install yarn
- apk update && apk add yarn nodejs npm
# workaround for Error: could not get uid/gid
- npm config set unsafe-perm true
# populate app.yaml file from app.template.yaml and env variables defined in gitlab CI/CD
- npx gae-ayaml-env
# install dependencies from package.json
- yarn install
# build a production build
- NODE_ENV=production yarn build
# deploy in app engine
- gcloud --quiet --project=$PROJECT_ID app deploy app.yaml
after_script:
- rm -f /tmp/$SERVICE_ACCOUNT_KEY.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment