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