Files
auth-service/Dockerfile
mifi f2dce58f5e
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build was killed
Tweaks
2023-05-24 10:46:01 -04:00

36 lines
1.0 KiB
Docker

ARG ENV=production
ARG MONGO_VERSION=latest
ARG PORT=9001
ARG NPM_TOKEN=not_set
ARG YARN_VERSION=3.5.0
## mongo build stage
FROM mongo:$MONGO_VERSION AS database
COPY docker-entrypoint-initdb.d/mongo-init-$MONGO_VERSION.sh ./docker-entrypoint-initdb.d/mongo-init.sh
## stage one, build the service
FROM node:20-bullseye-slim AS build
ENV YARN_VERSION $YARN_VERSION
ENV NODE_ENV development
ENV NPM_TOKEN $NPM_TOKEN
WORKDIR /home/node/app
COPY .npmrc /root
COPY .yarnrc.build.yml /root/.yarnrc.yml
COPY lib package*.json tsconfig.json yarn.lock ./
RUN yarn set version stable && yarn install
RUN yarn build
## this is stage two , where the app actually runs
FROM node:20-bullseye-slim AS containerize
ENV YARN_VERSION $YARN_VERSION
ENV NODE_ENV $ENV
ENV NPM_TOKEN $NPM_TOKEN
WORKDIR /home/node/app
COPY .npmrc /root
COPY .build.yarnrc.yml /root/.yarnrc.yml
COPY package*.json yarn.lock ./
RUN yarn set version stable && yarn install && yarn cache clean
COPY --from=build /home/node/app/dist .
EXPOSE $PORT
CMD ["node","index.js"]