diff --git a/Dockerfile b/Dockerfile index 27ef3b5..1c023ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,19 +7,19 @@ ENV GODEBUG netdns=cgo # 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" +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 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 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 \ @@ -28,8 +28,10 @@ RUN cd /go/src/github.com/lightningnetwork/lnd \ # Start a new, final image. FROM alpine as final -# Define a root volume for data persistence. -VOLUME /root/.lnd +RUN mkdir /relay/ +WORKDIR /relay/ + +VOLUME /relay/.lnd # Add bash and ca-certs, for quality of life and SSL-related reasons. RUN apk --no-cache add \ @@ -39,3 +41,20 @@ RUN apk --no-cache add \ # 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 + +COPY package.json . +RUN npm install +RUN npm install nodemon --save-dev +RUN npm install express --save-dev +RUN npm install webpack webpack-cli --save-dev + +RUN apk --no-cache add g++ gcc libgcc libstdc++ linux-headers make python +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 +COPY . . +RUN npm run tsc diff --git a/Dockerfile-node b/Dockerfile-node deleted file mode 100644 index 8d1b934..0000000 --- a/Dockerfile-node +++ /dev/null @@ -1,24 +0,0 @@ -FROM node:8 -RUN apt-get update -RUN apt-get install -f sqlite3 -RUN mkdir /relay/ -RUN chown -R node:node /relay -RUN chmod -R 777 /relay -USER node -# ENV NPM_CONFIG_PREFIX=/relay/.npm-global -# ENV PATH=$PATH:/relay/.npm-global/bin -WORKDIR /relay/ -COPY package.json . -RUN npm install -RUN npm install nodemon --save-dev -RUN npm install express --save-dev -RUN npm install webpack webpack-cli --save-dev -RUN npm install sqlite3 --build-from-source --save-dev -RUN npm install --save-dev sequelize -RUN npm rebuild -COPY . . -USER root -RUN chmod -R 777 /relay -RUN chown -R node:node /relay -USER node -RUN npm run tsc diff --git a/docker-compose.yml b/docker-compose.yml index 03e745a..c9f3304 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,29 +3,18 @@ volumes: node_modules: services: - lnd: + relay: build: context: . - dockerfile: Dockerfile - volumes: - - .lnd/:/root/.lnd - ports: - - "9735:9735" - - "10009:10009" - command: 'lnd --accept-keysend' - node_server: - build: - context: . - dockerfile: Dockerfile-node - depends_on: - - lnd volumes: - .:/relay - .lnd/:/relay/.lnd - node_modules:/relay/node_modules ports: - "3000:3000" - command: "npm start" + - "9735:9735" + - "10009:10009" + command: "lnd --accept-keysend --configfile=/relay/.lnd/lnd.conf && npm start" environment: - PORT=3000 - NODE_IP=mynodeip