Closed palagdan closed 2 months ago
@blcham It is very strange that Docker Image CI fails. I tested it locally and it builds the image without any issues.
@palagdan Try to do testing PR from main (e.g. modify README.md only) and see if docker build works ... See also warning here:
@blcham
These warnings were due to the actions/checkout@v2 in workflow file which had be deprecated. I updated to actions/checkout@v3. Now it should work fine.
@palagdan I tried it locally and I get the same error:
> ERROR [build 6/6] RUN npm run build 3.3s
------
> [build 6/6] RUN npm run build:
0.294
0.294 > react-starter-boilerplate-hmr@1.0.0 prebuild
0.294 > rimraf dist
0.294
0.329
0.329 > react-starter-boilerplate-hmr@1.0.0 build
0.329 > cross-env NODE_ENV=production webpack --mode production --env env=prod
0.329
0.767 (node:38) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
0.767 (Use `node --trace-deprecation ...` to show where the warning was created)
3.056 Error: error:0308010C:digital envelope routines::unsupported
3.056 at new Hash (node:internal/crypto/hash:69:19)
3.056 at Object.createHash (node:crypto:133:10)
3.056 at module.exports (/app/node_modules/webpack/lib/util/createHash.js:135:53)
3.056 at NormalModule._initBuildHash (/app/node_modules/webpack/lib/NormalModule.js:417:16)
3.056 at handleParseError (/app/node_modules/webpack/lib/NormalModule.js:471:10)
3.056 at /app/node_modules/webpack/lib/NormalModule.js:503:5
3.056 at /app/node_modules/webpack/lib/NormalModule.js:358:12
3.056 at /app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
3.056 at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
3.056 at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
3.056 at /app/node_modules/loader-runner/lib/LoaderRunner.js:236:3
3.056 at runSyncOrAsync (/app/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
3.056 at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
3.056 at Array.<anonymous> (/app/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
3.056 at Storage.finished (/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
3.056 at /app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
3.105 Browserslist: caniuse-lite is outdated. Please run:
3.105 npx browserslist@latest --update-db
3.105
3.105 Why you should do it regularly:
3.105 https://github.com/browserslist/browserslist#browsers-data-updating
3.120 node:internal/crypto/hash:69
3.120 this[kHandle] = new _Hash(algorithm, xofLen);
3.120 ^
3.120
3.120 Error: error:0308010C:digital envelope routines::unsupported
3.120 at new Hash (node:internal/crypto/hash:69:19)
3.120 at Object.createHash (node:crypto:133:10)
3.120 at module.exports (/app/node_modules/webpack/lib/util/createHash.js:135:53)
3.120 at NormalModule._initBuildHash (/app/node_modules/webpack/lib/NormalModule.js:417:16)
3.120 at handleParseError (/app/node_modules/webpack/lib/NormalModule.js:471:10)
3.120 at /app/node_modules/webpack/lib/NormalModule.js:503:5
3.120 at /app/node_modules/webpack/lib/NormalModule.js:358:12
3.120 at /app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
3.120 at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
3.120 at Array.<anonymous> (/app/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
3.120 at Storage.finished (/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
3.120 at /app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
3.120 at /app/node_modules/graceful-fs/graceful-fs.js:123:16
3.120 at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
3.120 opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
3.120 library: 'digital envelope routines',
3.120 reason: 'unsupported',
3.120 code: 'ERR_OSSL_EVP_UNSUPPORTED'
3.120 }
3.120
3.120 Node.js v18.20.4
------
Dockerfile:24
--------------------
22 |
23 | # Build the application
24 | >>> RUN npm run build
25 |
26 | #### Stage 2: Serve the React application from Nginx
--------------------
ERROR: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1
I executed it as follows:
git checkout package.json package-lock.json
docker build .
It is strange that it fails on the execution of npm run build
. I tried it locally without docker and it works fine as well.
Also I tried to rebuild image without cache and it works.
@palagdan do i understand it correcly, that you cannot simulate failure of docker build ?
@palagdan do i understand it correcly, that you cannot simulate failure of docker build ?
Locally no.
@blcham
The problem was due to the updated Node.js version. Starting with Node.js v17, the default OpenSSL configuration changed, and some older cryptographic algorithms and modes are no longer supported by default. That’s why the solution I found is to set the environment variable:
NODE_OPTIONS=--openssl-legacy-provider sudo npm run dev
@palagdan what would it require to remove this option, can we even update it more so we would not need NODE_OPTIONS=--openssl-legacy-provider
, please make fast investigation if possible -- so we at least know which dependencies causes those issues.
@palagdan, moreover, did you test that npm run dev
actually works... i.e., it shows some UI?
@blcham
I updated webpack to the latest version and made changes to the configuration because of the following message from the webpack team:
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "util": require.resolve("util/") }'
- install 'util'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "util": false }
I decided to disable this polyfill for now.
@palagdan, moreover, did you test that
npm run dev
actually works... i.e., it shows some UI?
Yes, after each update
@palagdan what would it require to remove this option, can we even update it more so we would not need
NODE_OPTIONS=--openssl-legacy-provider
, please make fast investigation if possible -- so we at least know which dependencies causes those issues.
Yes, you’re right. I updated webpack to the latest version and it is no longer needed.
Resolve #43