Fixes
This commit is contained in:
25
Dockerfile
25
Dockerfile
@@ -1,28 +1,35 @@
|
||||
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-alpine AS build
|
||||
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 package*.json ./
|
||||
COPY tsconfig.json ./
|
||||
COPY lib ./lib
|
||||
RUN ls -a
|
||||
RUN yarn install
|
||||
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-alpine AS containerize
|
||||
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 package*.json ./
|
||||
RUN yarn install --frozen-lockfile --production
|
||||
COPY .npmrc /root
|
||||
COPY .yarnrc.build.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","server/index.js"]
|
||||
|
||||
Reference in New Issue
Block a user