Shouldn't matter... directory structure
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2023-05-10 20:04:27 -04:00
parent a07e4ad9cc
commit 65ff23e406
6 changed files with 6 additions and 5 deletions

20
docker/Dockerfile Normal file
View File

@@ -0,0 +1,20 @@
## stage one, build the service
FROM node:20-alpine AS build
ENV NODE_ENV development
WORKDIR /home/node/app
COPY ../package*.json ./
COPY ../tsconfig.json ./
COPY ../lib ./lib
RUN ls -a
RUN yarn install
RUN yarn build
## this is stage two , where the app actually runs
FROM node:20-alpine AS auth-service
ENV NODE_ENV ${ENV:-production}
WORKDIR /home/node/app
COPY ../package*.json ./
RUN yarn install --frozen-lockfile --production
COPY --from=0 /home/node/app/dist .
EXPOSE ${PORT:-9001}
CMD ["node","server/index.js"]

View File

@@ -0,0 +1,42 @@
version: '3.8'
services:
auth-service_mongo:
env_file: .env.dev
container_name: ${CONTAINER_PREFIX:-dev}-auth-service_mongo
ports:
- 27017:27017
networks:
- backend
volumes:
- auth-db:/data/db
- auth-db:/data/configdb
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
restart: unless-stopped
image: mongo:latest
auth-service:
env_file: .env.dev
build:
context: .
args:
- PORT
- ENV
container_name: ${CONTAINER_PREFIX:-dev}-auth-service
ports:
- 9001:9001
environment:
- DB_HOST=${CONTAINER_PREFIX:-dev}-auth-service_mongo
networks:
- labs-net
- backend
restart: unless-stopped
image: node:20-alpine
depends_on:
- auth-service_mongo
networks:
labs-net:
name: labs-net
volumes:
auth-db:
external: true

View File

@@ -0,0 +1,48 @@
version: '3.8'
services:
auth-service_mongo:
container_name: ${CONTAINER_PREFIX:-staging}-auth-service_mongo
env_file:
- staging.env
networks:
- docknet
volumes:
- 'auth-db:/data/db'
- 'auth-db:/data/configdb'
# - '/volume1/docker/beethoven/labs-auth/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro'
restart: unless-stopped
image: mongo:4.4
auth-service:
env_file:
- staging.env
build:
context: .
args:
- PORT
- ENV
container_name: ${CONTAINER_PREFIX:-staging}-auth-service
environment:
- DB_HOST=${CONTAINER_PREFIX:-staging}-auth-service_mongo
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.grow.rule=Host(`${HOST}`) && Path(`${ROUTE_PREFIX}`)'
- 'traefik.http.routers.grow.entrypoints=websecure'
- 'traefik.http.routers.grow.tls=true'
- 'traefik.http.routers.grow.tls.certresolver=letsencrypt'
- 'traefik.http.routers.grow.service=grow-service'
- 'traefik.http.services.grow-service.loadbalancer.server.port=${PORT}'
networks:
- docknet
restart: unless-stopped
image: node:20-alpine
depends_on:
- auth-service_mongo
networks:
docknet:
name: docknet
external: true
volumes:
auth-db:
external: false

View File

@@ -0,0 +1,43 @@
version: '3.8'
services:
auth-service_mongo:
container_name: ${CONTAINER_PREFIX:-staging}-auth-service_mongo
env_file:
- staging.env
networks:
- docknet
volumes:
- auth-db:/data
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
restart: unless-stopped
image: mongo:4.4
auth-service:
env_file:
- staging.env
container_name: ${CONTAINER_PREFIX:-staging}-auth-service
environment:
- DB_HOST=${CONTAINER_PREFIX:-staging}-auth-service_mongo
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.grow.rule=Host(`${HOST}`) && Path(`${ROUTE_PREFIX}`)'
- 'traefik.http.routers.grow.entrypoints=websecure'
- 'traefik.http.routers.grow.tls=true'
- 'traefik.http.routers.grow.tls.certresolver=letsencrypt'
- 'traefik.http.routers.grow.service=grow-service'
- 'traefik.http.services.grow-service.loadbalancer.server.port=${PORT}'
networks:
- docknet
restart: unless-stopped
image: git.mifi.dev/mifi/mifi/auth:latest
depends_on:
- auth-service_mongo
networks:
docknet:
name: docknet
external: true
volumes:
auth-db:
external: false

View File

@@ -0,0 +1,12 @@
/* eslint-disable no-undef */
db = db.getSiblingDB(process.env.DB_NAME);
db.createUser({
user: process.env.DB_USERNAME,
pwd: process.env.DB_PASSWORD,
roles: [
{
role: 'readWrite',
db: process.env.DB_NAME,
},
],
});