Browse Source

Added docker files

feature/dockerfile-arm
Gonzalo Javier Aune 5 years ago
parent
commit
f06f198a83
  1. 52
      Dockerfile
  2. 26
      Dockerfile-node
  3. 21
      config/app.json
  4. 2
      config/config.json
  5. 35
      docker-compose.yml

52
Dockerfile

@ -1,16 +1,36 @@
FROM node:8
RUN apt-get update
RUN apt-get install -f sqlite3
USER node
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH=$PATH:/home/node/.npm-global/bin
WORKDIR /home/node
COPY package.json .
RUN npm install
RUN npm install -g nodemon --save-dev
RUN npm install -g express --save-dev
RUN npm install -g webpack webpack-cli --save-dev
RUN npm install -g sqlite3 --build-from-source --save-dev
RUN npm install -g --save-dev sequelize
RUN npm rebuild
COPY . .
FROM golang:1.13-alpine as builder
# Force Go to use the cgo based DNS resolver. This is required to ensure DNS
# queries required to connect to linked containers succeed.
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="master"
# Install dependencies and build the binaries.
RUN apk add --no-cache --update alpine-sdk \
git \
make \
gcc \
&& git clone https://github.com/lightningnetwork/lnd /go/src/github.com/lightningnetwork/lnd \
&& cd /go/src/github.com/lightningnetwork/lnd \
&& git checkout $checkout \
&& make \
&& make install tags="signrpc walletrpc chainrpc invoicesrpc"
# Start a new, final image.
FROM alpine as final
# Define a root volume for data persistence.
VOLUME /root/.lnd
# 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/

26
Dockerfile-node

@ -0,0 +1,26 @@
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 apt-get install telnet
RUN chmod 777 /usr/bin/telnet
RUN chmod -R 777 /relay
RUN chown -R node:node /relay
USER node
RUN npm run tsc

21
config/app.json

@ -1,17 +1,16 @@
{
"development": {
"senza_url": "http://localhost:3000/api/v2",
"macaroon_location": "/Users/evanfeenstra/code/lnd-dev/alice/data/chain/bitcoin/simnet/admin.macaroon",
"tls_location": "/Users/evanfeenstra/Library/Application Support/Lnd/tls.cert",
"node_ip": "127.0.0.1",
"lnd_port": "10001",
"macaroon_location": "/relay/.lnd/data/chain/bitcoin/mainnet/admin.macaroon",
"tls_location": "/relay/.lnd/tls.cert",
"node_ip": "172.21.0.2",
"lnd_port": "10009",
"node_http_protocol": "http",
"node_http_port": "3001",
"hub_api_url": "http://lvh.me/api/v1",
"hub_url": "http://lvh.me/ping",
"hub_invite_url": "http://lvh.me/invites",
"hub_check_invite_url": "http://lvh.me/check_invite",
"media_host": "localhost:5000"
"node_http_port": "3000",
"hub_api_url": "http://hub.sphinx.chat/api/v1",
"hub_url": "http://hub.sphinx.chat/ping",
"hub_invite_url": "http://hub.sphinx.chat/invites",
"hub_check_invite_url": "http://hub.sphinx.chat/check_invite",
"media_host": "memes.sphinx.chat"
},
"production": {
"senza_url": "https://staging.senza.us/api/v2/",

2
config/config.json

@ -1,7 +1,7 @@
{
"development": {
"dialect": "sqlite",
"storage": "/Users/Shared/sphinx.db"
"storage": "./sphinx.db"
},
"docker_development": {
"dialect": "sqlite",

35
docker-compose.yml

@ -0,0 +1,35 @@
version: '2'
volumes:
node_modules:
services:
lnd:
build:
context: .
dockerfile: Dockerfile
volumes:
- .lnd/:/root/.lnd
ports:
- "9735:9735"
- "10009:10009"
- "8080:8080"
command: 'lnd --alias=gonza-ireland --restlisten=0.0.0.0:8080 --listen=0.0.0.0:9735 --rpclisten=0.0.0.0:10009 --bitcoin.mainnet --bitcoin.active --bitcoin.node=neutrino'
node_server:
build:
context: .
dockerfile: Dockerfile-node
depends_on:
- lnd
volumes:
- .:/relay:cached
- .lnd/:/relay/.lnd
- node_modules:/relay/node_modules
ports:
- "3000:3000"
tty: true
# command: "npm start"
environment:
- PORT=3000
- NODE_IP=51.37.119.104
- NODE_ALIAS=gonza-ireland
- NODE_ENV=production
Loading…
Cancel
Save