Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
s.gozman committed Apr 8, 2022
2 parents c048aa4 + 2440273 commit a6de911
Show file tree
Hide file tree
Showing 17 changed files with 269 additions and 605 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
Dockerfile
docker-compose.yaml
.git
.github
.gitignore
test/
config/
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node CI deploy
name: Publish to remote server

on:
push:
Expand Down
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

FROM node:16.13-alpine3.12

WORKDIR /app

COPY package.json ./

RUN npm install

COPY . ./

ARG MONGODB_URL=mongodb
ARG MONGODB_NAME=finra-short-api
ARG MONGO_INITDB_ROOT_USERNAME=admin
ARG MONGO_INITDB_ROOT_PASSWORD=secret
ARG JWT_SECRET=SomeRandomString
ARG ADMIN_SECRET=RandomSecretForUserCreationRoute
ARG SANDBOX_TOKEN=TinkoffApiSandboxToken
ARG SENTRY_DSN=https://[email protected]/1
ARG SENTRY_TRACE_RATE=0.25

ENV MONGODB_URL=${MONGODB_URL}
ENV MONGODB_NAME=${MONGODB_NAME}
ENV MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME}
ENV MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
ENV JWT_SECRET=${JWT_SECRET}
ENV ADMIN_SECRET=${ADMIN_SECRET}
ENV SANDBOX_TOKEN=${SANDBOX_TOKEN}
ENV SENTRY_DSN=${SENTRY_DSN}
ENV SENTRY_TRACE_RATE=${SENTRY_TRACE_RATE}
ENV PORT=3001

EXPOSE 3001

RUN npm run build

CMD ["npm", "run", "start:prod"]
7 changes: 5 additions & 2 deletions config/.development.env_sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
PORT=3000
MONGODB_CONNECTION_URL=mongodb://127.0.0.1:27017/finra-short-api
PORT=3001
MONGODB_URL=mongodb
MONGODB_NAME=finra-short-api
MONGO_INITDB_ROOT_USERNAME=
MONGO_INITDB_ROOT_PASSWORD=
JWT_SECRET=
ADMIN_SECRET=
SANDBOX_TOKEN=
Expand Down
6 changes: 4 additions & 2 deletions config/.production.env_sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
PORT=3000
MONGODB_CONNECTION_URL=mongodb+srv://
MONGODB_URL=mongodb
MONGODB_NAME=finra-short-api
MONGO_INITDB_ROOT_USERNAME=
MONGO_INITDB_ROOT_PASSWORD=
JWT_SECRET=
ADMIN_SECRET=
SANDBOX_TOKEN=
Expand Down
6 changes: 4 additions & 2 deletions config/.test.env_sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
PORT=3000
MONGODB_CONNECTION_URL=
MONGODB_URL=mongodb
MONGODB_NAME=finra-short-api-test
MONGO_INITDB_ROOT_USERNAME=
MONGO_INITDB_ROOT_PASSWORD=
JWT_SECRET=TestKey
ADMIN_SECRET=AdminKey
SANDBOX_TOKEN=
Expand Down
18 changes: 18 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '3.8'

services:
mongodb:
image: 'mongo'
volumes:
- ./data:/data/db
env_file:
- ./config/.production.env

finra-api:
build: ./
ports:
- '3001:3001'
env_file:
- ./config/.production.env
depends_on:
- mongodb
Loading

0 comments on commit a6de911

Please sign in to comment.