This commit is contained in:
10
Dockerfile
10
Dockerfile
@@ -1,9 +1,3 @@
|
|||||||
## stage zero, setup mongo
|
|
||||||
FROM mongo:latest
|
|
||||||
WORKDIR /docker-entrypoint-initdb.d
|
|
||||||
COPY mongo-init.js ./
|
|
||||||
EXPOSE 27017
|
|
||||||
|
|
||||||
## 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
|
||||||
@@ -16,11 +10,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 containerize
|
FROM node:20-alpine AS auth-service
|
||||||
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=1 /home/node/app/dist .
|
COPY --from=0 /home/node/app/dist .
|
||||||
EXPOSE ${PORT:-9001}
|
EXPOSE ${PORT:-9001}
|
||||||
CMD ["node","server/index.js"]
|
CMD ["node","server/index.js"]
|
||||||
|
|||||||
@@ -5,12 +5,16 @@ 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: .
|
build:
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
- DB_NAME
|
||||||
networks:
|
networks:
|
||||||
- docknet
|
- docknet
|
||||||
volumes:
|
volumes:
|
||||||
- 'auth-db:/data/db'
|
- 'auth-db:/data/db'
|
||||||
- 'auth-db:/data/configdb'
|
- 'auth-db:/data/configdb'
|
||||||
|
- '/docker-entrypoint-initdb.d/mongo-init.js'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: mongo:latest
|
image: mongo:latest
|
||||||
auth-service:
|
auth-service:
|
||||||
|
|||||||
Reference in New Issue
Block a user