Added Docker support files

This commit is contained in:
Djuri Baars 2022-01-14 01:36:28 +01:00
parent 0f7a91cef2
commit cf4cd5b277
5 changed files with 43 additions and 4 deletions

View File

@ -1,4 +1,4 @@
PORT=8080
PORT=7464
ALLOWED_HOSTS=['*']
MACAROON=ABC
LND_REST_API=localhost:8080

15
Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM node:16-bullseye-slim
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /usr/src/app
COPY package*.json yarn.lock ./
RUN yarn install --production
RUN yarn global add ts-node
EXPOSE 3000
CMD ["node"]

18
docker-compose.yml Normal file
View File

@ -0,0 +1,18 @@
version: '3.7'
services:
api:
build: .
env_file: .env
restart: on-failure:5
ports:
- 7464:7464
volumes:
- ./:/usr/src/app/
entrypoint: ["ts-node", "src/server.ts"]
networks:
default:
ipam:
config:
- subnet: 10.35.14.0/24
driver: default

View File

@ -1,13 +1,18 @@
import 'reflect-metadata';
import dotenv from 'dotenv';
import {build} from './app';
dotenv.config();
const server = build({
logger: {
level: 'info',
level: 'warn',
prettyPrint: true,
},
});
server.listen(3000, (err, address) => {
server.listen(process.env.PORT || 7464, '::', (err, address) => {
if (err) {
server.log.error(err);
process.exit(1);

View File

@ -1,6 +1,7 @@
{
"extends": "fastify-tsconfig",
"compilerOptions": {
"target": "ES2021",
"module": "CommonJS",
"experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
"emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */