-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the transpiled artifacts to build/ for a slimmer native Node Dock… #306
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
* | ||
!build/ | ||
!class/ | ||
!controllers/ | ||
!scripts/ | ||
!static/ | ||
!templates/ | ||
!utils/ | ||
!*.js | ||
!.babelrc | ||
!.eslint* | ||
!admin.macaroon | ||
!package*.json | ||
!rpc.proto | ||
!tls.cert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
admin.macaroon | ||
tls.cert | ||
build/ | ||
logs/ | ||
|
||
# dependencies | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,19 +13,17 @@ RUN apt-get update && apt-get -y install python3 | |
|
||
WORKDIR /lndhub | ||
|
||
# Copy 'package-lock.json' and 'package.json' | ||
COPY package.json package-lock.json ./ | ||
# Copy project files and folders to the current working directory | ||
COPY . . | ||
|
||
# Install dependencies | ||
RUN npm i | ||
|
||
# Copy project files and folders to the current working directory | ||
COPY . . | ||
RUN npm run build | ||
|
||
# Delete git data as it's not needed inside the container | ||
RUN rm -rf .git | ||
|
||
FROM node:16-bullseye-slim | ||
FROM node:16-alpine | ||
|
||
# Create a specific user so LNDHub doesn't run as root | ||
COPY --from=perms /etc/group /etc/passwd /etc/shadow /etc/ | ||
|
@@ -34,10 +32,11 @@ COPY --from=perms /etc/group /etc/passwd /etc/shadow /etc/ | |
COPY --from=builder /lndhub /lndhub | ||
|
||
# Create logs folder and ensure permissions are set correctly | ||
RUN mkdir /lndhub/logs && chown -R lndhub:lndhub /lndhub | ||
RUN mkdir -p /lndhub/logs && chown -R lndhub:lndhub /lndhub | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This broke the Docker build if the directory already existed. |
||
USER lndhub | ||
|
||
ENV PORT=3000 | ||
EXPOSE 3000 | ||
WORKDIR /lndhub | ||
|
||
CMD cp $LND_CERT_FILE /lndhub/ && cp $LND_ADMIN_MACAROON_FILE /lndhub/ && cd /lndhub && npm start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,9 @@ let express = require('express'); | |
let router = express.Router(); | ||
let logger = require('../utils/logger'); | ||
const MIN_BTC_BLOCK = 670000; | ||
console.log('using config', JSON.stringify(config)); | ||
if (process.env.NODE_ENV !== 'prod') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No password logs in production. |
||
console.log('using config', JSON.stringify(config)); | ||
} | ||
|
||
var Redis = require('ioredis'); | ||
var redis = new Redis(config.redis); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reduces the Docker image by ~100MB.