Creating home assistant frontend docker container fails for production build

I was trying to create home-assistant frontend docker container from the source code on github. The docker container creation fails with the below given error:

yarn install v1.22.4
[1/4] Resolving packages…
[2/4] Fetching packages…
info [email protected]: The platform “linux” is incompatible with this module.
info “[email protected]” is an optional dependency and failed compatibility check. Excluding it from installation.
error [email protected]: The engine “node” is incompatible with this module. Expected version “>=10.13.0”. Got “8.11.1”
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
The command ‘/bin/sh -c yarn install --frozen-lockfile’ returned a non-zero code: 1

When i used the node version as 10.13.0+, i was able to build the frontend docker container with some warnings, but docker container was unable to build the production version of the app. The error message is given below during running the docker container:

=============================
[09:45:13] Starting ‘webpack-prod-app’…
[BABEL] Note: The code generator has deoptimised the styling of /frontend/node_modules/hls.js/dist/hls.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /frontend/node_modules/hls.js/dist/hls.js as it exceeds the max of 500KB.
[09:51:24] Build done @ 9:51:24 AM
Child
920 modules

ERROR in ./src/cast/receiver_messages.ts
Module not found: Error: Can't resolve './dev_const' in '/frontend/src/cast'

ERROR in ./src/cast/cast_manager.ts
Module not found: Error: Can't resolve './dev_const' in '/frontend/src/cast'

ERROR in ./src/cast/const.ts
Module not found: Error: Can't resolve './dev_const' in '/frontend/src/cast'

Child
921 modules

ERROR in ./src/cast/cast_manager.ts
Module not found: Error: Can't resolve './dev_const' in '/frontend/src/cast'

ERROR in ./src/cast/receiver_messages.ts
Module not found: Error: Can't resolve './dev_const' in '/frontend/src/cast'

ERROR in ./src/cast/const.ts
Module not found: Error: Can't resolve './dev_const' in '/frontend/src/cast'

[09:51:24] Finished ‘webpack-prod-app’ after 6.18 min
[09:51:24] Starting ‘compress-app’…
[09:51:54] Finished ‘compress-app’ after 30 s
[09:51:54] Starting ‘gen-pages-prod’…
[09:51:54] Starting ‘gen-index-app-prod’…
[09:51:54] Starting ‘gen-service-worker-prod’…
[09:51:54] ‘gen-pages-prod’ errored after 6.86 ms
[09:51:54] Error: Cannot find module ‘/frontend/hass_frontend/frontend_latest/manifest.json’
Require stack:

  • /frontend/build-scripts/gulp/entry-html.js
  • /frontend/build-scripts/gulp/app.js
  • /frontend/node_modules/require-dir/index.js
  • /frontend/gulpfile.js
  • /frontend/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js
  • /frontend/node_modules/gulp-cli/index.js
  • /frontend/node_modules/gulp/bin/gulp.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1014:15)
    at Function.Module._load (internal/modules/cjs/loader.js:884:27)
    at Module.require (internal/modules/cjs/loader.js:1074:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at /frontend/build-scripts/gulp/entry-html.js:63:26
    at gen-pages-prod (/frontend/node_modules/undertaker/lib/set-task.js:13:15)
    at bound (domain.js:429:14)
    at runBound (domain.js:442:12)
    at asyncRunner (/frontend/node_modules/async-done/index.js:55:18)
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
    [09:51:54] ‘build-app’ errored after 8.52 min
    [09:51:54] The following tasks did not complete: gen-index-app-prod, gen-service-worker-prod
    [09:51:54] Did you forget to signal async completion?
    =================================================================================
    Node version seems to be the problem. Can someone please help me to resolve this?