Get value of package.json in gitLab CI YML

If you are not against installing additional packages you can use jq which allows for much more flexibility (available in repository for both Ubuntu and Alpine). Once you install it (for example apt-get update && apt-get install -yqq jq on Ubuntu):

- export VERSION=$(jq -r .version package.json)
- cd /opt/core/bundle && docker build -t $CI_REGISTRY_IMAGE:$VERSION .
- docker push $CI_REGISTRY_IMAGE:$VERSION

I would argue the easiest way to retrieve version from your package.json is to use node itself.

build:
  stage: build
  script:
    - export VERSION=$(node -p "require('./package.json').version")
    - export CONTAINER_RELEASE_IMAGE=$CI_REGISTRY_IMAGE:$VERSION
    - cd /opt/core/bundle && docker build -t $CONTAINER_RELEASE_IMAGE .
    - docker push $CONTAINER_RELEASE_IMAGE

The -p/--print flag means evaluate the expression and print the result. It's functionally equivalent to using the -e/--eval= flag and wrapping the expression in console.log(...).