Bringing back the mongo build stage...
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
## mongo build stage
|
||||
FROM mongo:${MONGO_VERSION:-latest} AS database
|
||||
WORKDIR /
|
||||
COPY mongo-init.js ./docker-entrypoint-initdb.d/
|
||||
|
||||
## stage one, build the service
|
||||
FROM node:20-alpine AS build
|
||||
ENV NODE_ENV development
|
||||
@@ -10,11 +15,11 @@ RUN yarn install
|
||||
RUN yarn build
|
||||
|
||||
## this is stage two , where the app actually runs
|
||||
FROM node:20-alpine AS auth-service
|
||||
FROM node:20-alpine AS containerize
|
||||
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 .
|
||||
COPY --from=build /home/node/app/dist .
|
||||
EXPOSE ${PORT:-9001}
|
||||
CMD ["node","server/index.js"]
|
||||
|
||||
@@ -5,24 +5,29 @@ services:
|
||||
container_name: ${CONTAINER_PREFIX:-staging}-auth-service_mongo
|
||||
env_file:
|
||||
- staging.env
|
||||
build:
|
||||
context: .
|
||||
target: database
|
||||
args:
|
||||
- MONGO_VERSION
|
||||
networks:
|
||||
- docknet
|
||||
volumes:
|
||||
- 'auth-db:/data/db'
|
||||
- 'auth-db:/data/configdb'
|
||||
- './mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro'
|
||||
# - '/volume1/docker/beethoven/labs-auth/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro'
|
||||
restart: unless-stopped
|
||||
image: mongo:4.4
|
||||
image: mongo:${MONGO_VERSION:-latest}
|
||||
auth-service:
|
||||
container_name: ${CONTAINER_PREFIX:-staging}-auth-service
|
||||
env_file:
|
||||
- staging.env
|
||||
build:
|
||||
context: .
|
||||
target: containerize
|
||||
args:
|
||||
- PORT
|
||||
- ENV
|
||||
container_name: ${CONTAINER_PREFIX:-staging}-auth-service
|
||||
environment:
|
||||
- DB_HOST=${CONTAINER_PREFIX:-staging}-auth-service_mongo
|
||||
labels:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable no-undef */
|
||||
db = db.getSiblingDB(process.env.DB_NAME);
|
||||
//db = db.getSiblingDB(process.env.DB_NAME);
|
||||
db.createUser({
|
||||
user: process.env.DB_USERNAME,
|
||||
pwd: process.env.DB_PASSWORD,
|
||||
|
||||
Reference in New Issue
Block a user