1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-21 13:47:39 +02:00

fix: docker oss image now running with ESM (#10073)

The docker image was trying to load as CJS module:
```
unleash-1  | node:internal/modules/cjs/loader:1404
unleash-1  |   throw err;
unleash-1  |   ^
unleash-1  | 
unleash-1  | Error: Cannot find module './build'
unleash-1  | Require stack:
unleash-1  | - /unleash/index.js
unleash-1  |     at Function._resolveFilename (node:internal/modules/cjs/loader:1401:15)
unleash-1  |     at defaultResolveImpl (node:internal/modules/cjs/loader:1057:19)
unleash-1  |     at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1062:22)
unleash-1  |     at Function._load (node:internal/modules/cjs/loader:1211:37)
unleash-1  |     at TracingChannel.traceSync (node:diagnostics_channel:322:14)
unleash-1  |     at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
unleash-1  |     at Module.require (node:internal/modules/cjs/loader:1487:12)
unleash-1  |     at require (node:internal/modules/helpers:135:16)
unleash-1  |     at Object.<anonymous> (/unleash/index.js:3:17)
unleash-1  |     at Module._compile (node:internal/modules/cjs/loader:1730:14) {
unleash-1  |   code: 'MODULE_NOT_FOUND',
unleash-1  |   requireStack: [ '/unleash/index.js' ]
unleash-1  | }
unleash-1  | 
unleash-1  | Node.js v22.15.1
```

This PR makes use of the existing server.ts file instead of having a
specific index.js inside the docker folder, because they both do the
same thing
This commit is contained in:
Gastón Fournier 2025-06-03 12:33:02 +02:00 committed by GitHub
parent c24c58c51c
commit 6002c5894d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 11 deletions

View File

@ -25,16 +25,14 @@ ENV TZ=UTC
WORKDIR /unleash
COPY --from=builder /unleash/build /unleash/build
COPY --from=builder /unleash/build /unleash/
COPY --from=builder /unleash/node_modules /unleash/node_modules
COPY ./docker/index.js /unleash/index.js
RUN rm -rf /usr/local/lib/node_modules/npm/
EXPOSE 4242
USER node
CMD ["node", "index.js"]
CMD ["node", "dist/server.js"]

View File

@ -1,7 +0,0 @@
'use strict';
const unleash = require('./build');
let options = {};
unleash.start(options);