BlueWallet / LndHub

Wrapper for Lightning Network Daemon. It provides separate accounts for end-users
http://LndHub.io
MIT License
752 stars 185 forks source link

Add the transpiled artifacts to build/ for a slimmer native Node Dock… #306

Closed kwizzn closed 2 years ago

kwizzn commented 2 years ago

This adds the transpiled artifacts to a new build/ directory for a slimmer (node:16-alpine) Docker image that does not require babel-node. This is a first iteration that makes LndHub run in our environment, I'm contributing this upstream in case it helps anyone. If it is appreciated, I have some future improvements in the pipeline. :)

Overtorment commented 2 years ago

@AaronDewes can you pls take a look..?

AaronDewes commented 2 years ago

@AaronDewes can you pls take a look..?

Sorry for the delay, while I agree the base image should be changed, #314 is better than this PR because it drops babel entirely. @kwizzn Can I merge this into #314?

kwizzn commented 2 years ago

Sure @AaronDewes, go ahead.

Overtorment commented 2 years ago

so, what's the verdict? we can merge this and then work on removing babel (since #314 has conflicts), or we can wait

AaronDewes commented 2 years ago

This can probably get merged, I'll improve the other pr later

Overtorment commented 2 years ago

thanks!

Overtorment commented 2 years ago

hmm, after merging this i get build fail:

-----> Build
       Running build

       > lndhub@1.4.1 build /tmp/build_82e34581
       > babel ./ --ignore node_modules/ --ignore *.spec.js --out-dir ./build

SyntaxError: /tmp/build_82e34581/.heroku/node/lib/node_modules/npm/docs/gatsby-browser.js: Support for the experimental syntax 'jsx' isn't currently enabled (7:10):
  5 |
  6 | export const wrapPageElement = ({ element, props }) => {
> 7 |   return <Layout {...props} >{element}</Layout>
    |          ^
  8 | }
  9 |
Add @babel/preset-react (https://git.io/JfeDR) to the 'presets' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-jsx (https://git.io/vb4yA) to the 'plugins' section to enable parsing.
    at Parser._raise (/tmp/build_82e34581/node_modules/@babel/parser/lib/index.js:807:17)
    at Parser.raiseWithData (/tmp/build_82e34581/node_modules/@babel/parser/lib/index.js:800:17)
    at Parser.expectOnePlugin (/tmp/build_82e34581/node_modules/@babel/parser/lib/index.js:3281:18)
    at Parser.parseExprAtom (/tmp/build_82e34581/node_modules/@babel/parser/lib/index.js:11544:20)
    at Parser.parseExprSubscripts (/tmp/build_82e34581/node_modules/@babel/parser/lib/index.js:11119:23)
    at Parser.parseUpdate (/tmp/build_82e34581/node_modules/@babel/parser/lib/index.js:11099:21)
    at Parser.parseMaybeUnary (/tmp/build_82e34581/node_modules/@babel/parser/lib/index.js:11077:23)
    at Parser.parseMaybeUnaryOrPrivate (/tmp/build_82e34581/node_modules/@babel/parser/lib/index.js:10900:77)
    at Parser.parseExprOps (/tmp/build_82e34581/node_modules/@babel/parser/lib/index.js:10907:23)
    at Parser.parseMaybeConditional (/tmp/build_82e34581/node_modules/@babel/parser/lib/index.js:10877:23) {
  loc: Position { line: 7, column: 9 },
  pos: 209,
  missingPlugin: [ 'jsx', 'flow', 'typescript' ],
  code: 'BABEL_PARSE_ERROR'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! lndhub@1.4.1 build: `babel ./ --ignore node_modules/ --ignore *.spec.js --out-dir ./build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the lndhub@1.4.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npmcache.6djJ6/_logs/2021-11-22T14_21_38_301Z-debug.log
-----> Build failed