question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to build docker images

See original GitHub issue

Expected Behavior

Deploying a production instance of backstage should be simple

Current Behavior

Not enough docs, after digging around I find that I probably should do something like:

yarn
yarn workspace backend run build-image 

From the root folder of the project.

This works fine on my local machine, but fail with a very unclear error in the CI:

yarn workspace v1.22.10
yarn run v1.22.10
$ backstage-cli backend:build-image --build --tag gcr.io/snyk-main/backstage
$ /home/circleci/project/node_modules/.bin/lerna run --scope backend --scope app build
lerna notice cli v3.22.1
lerna info ci enabled
lerna notice filter including ["backend","app"]
lerna info filter [ 'backend', 'app' ]
lerna info Executing command in 2 packages: "yarn run build"
lerna ERR! yarn run build exited 1 in 'app'
lerna ERR! yarn run build stdout:
$ backstage-cli app:build
Loaded config from app-config.yaml, app-config.local.yaml
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

lerna ERR! yarn run build stderr:
Env config file 'app-config.production.yaml' is not loaded as APP_ENV and NODE_ENV-based config loading has been removed
To load the config file, use --config <path>, listing every config file that you want to load
internal/child_process.js:403
    throw errnoException(err, 'spawn');
    ^

Error: spawn ENOMEM
    at ChildProcess.spawn (internal/child_process.js:403:11)
    at spawn (child_process.js:553:9)
    at Object.fork (child_process.js:121:10)
    at fork (/home/circleci/project/node_modules/worker-farm/lib/fork.js:17:36)
    at Farm.startChild (/home/circleci/project/node_modules/worker-farm/lib/farm.js:107:16)
    at Farm.processQueue (/home/circleci/project/node_modules/worker-farm/lib/farm.js:288:10)
    at Farm.<anonymous> (/home/circleci/project/node_modules/worker-farm/lib/farm.js:98:21)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7) {
  errno: -12,
  code: 'ENOMEM',
  syscall: 'spawn'
}
error Command failed with exit code 1.

Probably related to backstage/backstage#2994

Possible Solution

  • Document the flow for deploying backstage images (ideally, with common CI tools like GitHub actions)

Steps to Reproduce

  1. Create new backstage project
  2. Try to build docker image in CircleCI

Your Environment

  • NodeJS Version (v12): v14
  • Operating System and Version (e.g. Ubuntu 14.04): Circle docker image for node
  • Browser Information:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
regicsolutionscommented, Dec 22, 2020

@andrewthauer Thanks for sharing! With the app-backend plugin this script should technically live in the backend package.json no? definitely see it coming in handy when building multiple environments, each having there own command 😃

1reaction
andrewthauercommented, Dec 8, 2020

Yep, seems like it. CircleCI boxes incorrectly report the number of CPU’s so tasks like terser may fail on default medium machines.

Try setting the following environment variables. This has been working for us consistently for the past 2-3 months now.

NODE_OPTIONS="--max-old-space-size=4096"
BACKSTAGE_CLI_BUILD_PARALLEL="2"

It’s defined in packages/cli/src/lib/parallel.ts

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to build my docker image
I have a created a project as well as dockerfiles inside it. I'm trying to run it from docker but I keep getting...
Read more >
Docker : image build failed - Stack Overflow
Paths in a Dockerfile are always relative to the the context directory. The context directory is the positional argument passed to docker ......
Read more >
Failed to build docker image with the Dockerfile #5499 - GitHub
Tried to build a docker image with the command : docker image build -t aws-cdk:1.0 . But failed with the following error.
Read more >
Building your Docker Image - Runnable
Detailed steps to build your Docker image and troubleshoot errors encountered during builds with Ruby on Rails applications.
Read more >
Docker image build failed - GitLab Forum
Not sure. I have installed gitlab-runner as a docker container using the following command: docker run -d --name gitlab-runner --restart always ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found