10 changed files with 217 additions and 35 deletions
@ -1,16 +1,81 @@ |
|||||
FROM node:8 |
FROM golang:1.13-alpine as builder |
||||
RUN apt-get update |
LABEL maintainer="gonzaloaune@stakwork.com" |
||||
RUN apt-get install -f sqlite3 |
|
||||
USER node |
# Force Go to use the cgo based DNS resolver. This is required to ensure DNS |
||||
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global |
# queries required to connect to linked containers succeed. |
||||
ENV PATH=$PATH:/home/node/.npm-global/bin |
ENV GODEBUG netdns=cgo |
||||
WORKDIR /home/node |
|
||||
COPY package.json . |
# Pass a tag, branch or a commit using build-arg. This allows a docker |
||||
|
# image to be built from a specified Git state. The default image |
||||
|
# will use the Git tip of master by default. |
||||
|
ARG checkout="v0.9.0-beta" |
||||
|
# ARG checkout="master" |
||||
|
|
||||
|
# Install dependencies and build the binaries. |
||||
|
RUN apk add --no-cache --update alpine-sdk git make gcc openssh-client |
||||
|
|
||||
|
# RUN mkdir /root/.ssh/ |
||||
|
# ADD id_rsa /root/.ssh/id_rsa |
||||
|
# RUN touch /root/.ssh/known_hosts |
||||
|
# RUN ssh-keyscan github.com >> /root/.ssh/known_hosts |
||||
|
# RUN git clone git@github.com:stakwork/lnd-lean.git /go/src/github.com/lightningnetwork/lnd |
||||
|
|
||||
|
RUN git clone https://github.com/lightningnetwork/lnd /go/src/github.com/lightningnetwork/lnd |
||||
|
RUN cd /go/src/github.com/lightningnetwork/lnd \ |
||||
|
&& git checkout $checkout \ |
||||
|
&& make \ |
||||
|
&& make install tags="signrpc walletrpc chainrpc invoicesrpc experimental" |
||||
|
|
||||
|
# Start a new, final image. |
||||
|
FROM alpine as final |
||||
|
|
||||
|
EXPOSE 80 |
||||
|
EXPOSE 9735/tcp |
||||
|
EXPOSE 9735/udp |
||||
|
EXPOSE 10009/tcp |
||||
|
EXPOSE 10009/udp |
||||
|
|
||||
|
ENV NODE_ENV production |
||||
|
|
||||
|
# Add bash and ca-certs, for quality of life and SSL-related reasons. |
||||
|
RUN apk --no-cache add \ |
||||
|
bash \ |
||||
|
ca-certificates |
||||
|
|
||||
|
# Copy the binaries from the builder image. |
||||
|
COPY --from=builder /go/bin/lncli /bin/ |
||||
|
COPY --from=builder /go/bin/lnd /bin/ |
||||
|
|
||||
|
RUN apk add --update nodejs nodejs-npm sqlite git supervisor |
||||
|
|
||||
|
RUN git clone https://github.com/stakwork/sphinx-relay /relay/ |
||||
|
|
||||
|
WORKDIR /relay/ |
||||
|
|
||||
|
RUN git checkout feature/docker |
||||
|
|
||||
RUN npm install |
RUN npm install |
||||
RUN npm install -g nodemon --save-dev |
RUN npm install nodemon --save-dev |
||||
RUN npm install -g express --save-dev |
RUN npm install express --save-dev |
||||
RUN npm install -g webpack webpack-cli --save-dev |
RUN npm install webpack webpack-cli --save-dev |
||||
RUN npm install -g sqlite3 --build-from-source --save-dev |
|
||||
RUN npm install -g --save-dev sequelize |
RUN apk --no-cache add g++ gcc libgcc libstdc++ linux-headers make python jq git |
||||
|
RUN npm install --quiet node-gyp -g |
||||
|
|
||||
|
RUN npm install sqlite3 --build-from-source --save-dev |
||||
|
RUN npm install --save-dev sequelize |
||||
RUN npm rebuild |
RUN npm rebuild |
||||
COPY . . |
RUN npm run tsc |
||||
|
|
||||
|
VOLUME /relay/.lnd |
||||
|
|
||||
|
COPY ./lnd.conf.sample /relay/.lnd/lnd.conf |
||||
|
|
||||
|
COPY init.sh /etc/profile.d/ |
||||
|
RUN sudo chmod +x /etc/profile.d/init.sh |
||||
|
|
||||
|
RUN mkdir -p /var/log/supervisor |
||||
|
COPY ./supervisord.conf /etc/supervisord.conf |
||||
|
COPY ./lnd_supervisor.conf /etc/supervisor.d/lnd_supervisor.ini |
||||
|
COPY ./relay_supervisor.conf /etc/supervisor.d/relay_supervisor.ini |
||||
|
CMD ["/usr/bin/supervisord"] |
||||
|
@ -0,0 +1,22 @@ |
|||||
|
version: '2' |
||||
|
volumes: |
||||
|
node_modules: |
||||
|
|
||||
|
services: |
||||
|
relay: |
||||
|
build: |
||||
|
context: . |
||||
|
volumes: |
||||
|
- .:/relay |
||||
|
- .lnd/:/relay/.lnd |
||||
|
- node_modules:/relay/node_modules |
||||
|
ports: |
||||
|
- "3000:3000" |
||||
|
- "9735:9735" |
||||
|
- "10009:10009" |
||||
|
command: "lnd --accept-keysend --configfile=/relay/.lnd/lnd.conf && npm start" |
||||
|
environment: |
||||
|
- PORT=3000 |
||||
|
- NODE_IP=mynodeip |
||||
|
- NODE_ALIAS=myalias |
||||
|
- NODE_ENV=production |
@ -0,0 +1,2 @@ |
|||||
|
NODE_IP=$(curl http://169.254.170.2/v4/e52231f4-0246-4fc5-bc3e-ac20df1b118e | echo $(jq -r .DockerName).$NODE_DOMAIN) |
||||
|
NODE_ALIAS=$(curl http://169.254.170.2/v4/e52231f4-0246-4fc5-bc3e-ac20df1b118e | echo $(jq -r .DockerName)) |
@ -0,0 +1,12 @@ |
|||||
|
bitcoin.mainnet=1 |
||||
|
bitcoin.active=1 |
||||
|
bitcoin.node=neutrino |
||||
|
accept-keysend=1 |
||||
|
|
||||
|
listen=0.0.0.0:9735 |
||||
|
rpclisten=0.0.0.0:10009 |
||||
|
|
||||
|
ignore-historical-gossip-filters=true |
||||
|
nobootstrap=true |
||||
|
numgraphsyncpeers=1 |
||||
|
routing.assumechanvalid=1 |
@ -0,0 +1,6 @@ |
|||||
|
[program:lnd] |
||||
|
user=root |
||||
|
command=lnd --lnddir=/relay/.lnd/ |
||||
|
startretries=999999999999999999999999999 |
||||
|
autostart=true |
||||
|
autorestart=true |
@ -0,0 +1,6 @@ |
|||||
|
[program:relay] |
||||
|
user=root |
||||
|
command=npm start --prefix /relay/ |
||||
|
startretries=999999999999999999999999999 |
||||
|
autostart=true |
||||
|
autorestart=true |
@ -0,0 +1,17 @@ |
|||||
|
[unix_http_server] |
||||
|
file=/run/supervisord.sock ; (the path to the socket file) |
||||
|
|
||||
|
[supervisord] |
||||
|
logfile=/var/log/supervisord.log ; (main log file;default $CWD/supervisord.log) |
||||
|
loglevel=info ; (log level;default info; others: debug,warn,trace) |
||||
|
nodaemon=true |
||||
|
|
||||
|
[rpcinterface:supervisor] |
||||
|
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface |
||||
|
|
||||
|
[supervisorctl] |
||||
|
serverurl=unix:///run/supervisord.sock ; use a unix:// URL for a unix socket |
||||
|
|
||||
|
[include] |
||||
|
files = /etc/supervisor.d/*.ini |
||||
|
|
Loading…
Reference in new issue