Skip to content

Commit

Permalink
chore: ♻️ migrated to multi-stage docker file
Browse files Browse the repository at this point in the history
Signed-off-by: Tiago Barbosa <tbarbos@hotmail.com>
  • Loading branch information
t1agob committed May 15, 2024
1 parent 17c0886 commit 9f03e05
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions order-management/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
FROM node:lts-bullseye@sha256:6d72e3efec7d7844d5fd268e25da86c59306bd732341b25d810840dd1d4c05c8
ENV NODE_ENV=production
FROM node as builder
# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
COPY package*.json ./
RUN npm install --production --silent && mv node_modules ../

RUN npm ci
COPY . .
EXPOSE 40000
RUN chown -R node /usr/src/app
USER node
RUN npm run build
CMD ["npm", "run", "start"]

FROM node:slim
ENV NODE_ENV production
USER node

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
COPY package*.json ./
RUN npm ci --production
COPY --from=builder /usr/src/app/dist ./dist

EXPOSE 40000
CMD [ "npm", "run", "start" ]

0 comments on commit 9f03e05

Please sign in to comment.