feat: docker setup wip (#3)

This commit is contained in:
Anthony Potdevin 2020-03-22 21:16:46 +01:00 committed by GitHub
parent 7800fe3d76
commit 6f74887b58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 88 additions and 5 deletions

4
client/.dockerignore Normal file
View file

@ -0,0 +1,4 @@
node_modules
.git
.gitignore
build

14
client/Dockerfile Normal file
View file

@ -0,0 +1,14 @@
# stage: 1
FROM node:11-alpine as react-build
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . .
RUN yarn install --production=true
RUN yarn build
# stage: 2 — the production environment
FROM nginx:alpine
COPY /config/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=react-build /usr/src/app/build /usr/share/nginx/html/
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

15
client/config/nginx.conf Normal file
View file

@ -0,0 +1,15 @@
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

View file

@ -1,6 +1,6 @@
{
"name": "app",
"version": "0.1.6.4",
"version": "0.1.7",
"private": true,
"dependencies": {
"@apollo/react-hooks": "^3.1.3",

View file

@ -29,5 +29,5 @@
"emitDecoratorMetadata": true
},
"include": ["src"],
"exclude": ["node_modules", "build", "scripts"]
"exclude": ["node_modules", "build", "scripts", "**/*.stories.tsx"]
}

32
docker-compose.yml Normal file
View file

@ -0,0 +1,32 @@
version: "3"
services:
##########################
### SETUP SERVER CONTAINER
##########################
backend:
build:
context: ./server
dockerfile: Dockerfile
environment:
- NODE_ENV=production
ports:
- "3001:3001"
volumes:
- ./server/
restart: always
##########################
### SETUP CLIENT CONTAINER
##########################
frontend:
build:
context: ./client
dockerfile: Dockerfile
environment:
- NODE_ENV=production
ports:
- "80:80"
volumes:
- ./client/
depends_on:
- backend
restart: always

3
server/.dockerignore Normal file
View file

@ -0,0 +1,3 @@
node_modules
.git
.gitignore

15
server/Dockerfile Normal file
View file

@ -0,0 +1,15 @@
FROM node:11-alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . .
RUN apk update && apk upgrade \
&& apk --no-cache add --virtual builds-deps build-base python \
&& yarn add node-gyp node-pre-gyp
RUN yarn install --production=true
RUN yarn global add webpack
RUN yarn build
EXPOSE 3001
CMD ["npm", "start"]

View file

@ -1,6 +1,6 @@
import { getForwards } from './Forwards';
import { getForwards } from './forwards';
import { getResume } from './resume';
import { getChainTransactions } from './ChainTransactions';
import { getChainTransactions } from './chainTransactions';
export const invoiceQueries = {
getResume,

View file

@ -3,7 +3,7 @@ import { getPayments, getInvoices, getNode } from 'ln-service';
import { logger } from '../../../helpers/logger';
import { requestLimiter } from '../../../helpers/rateLimiter';
import { getAuthLnd, getErrorMsg } from '../../../helpers/helpers';
import { PaymentsProps, InvoicesProps, NodeProps } from './Resume.interface';
import { PaymentsProps, InvoicesProps, NodeProps } from './resume.interface';
import { compareDesc } from 'date-fns';
import { sortBy } from 'underscore';
import { GetResumeType } from '../../../schemaTypes/query/transactions/resume';