Skip to content

Commit

Permalink
chore: update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
neverovski committed Mar 11, 2024
1 parent 5134065 commit b5db370
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@ USER node
FROM node:20-alpine3.17 AS build
LABEL author="Dmitry Neverovski <dmitryneverovski@gmail.com>"

WORKDIR /app

ARG NODE_ENV
ENV NODE_ENV=${NODE_ENV:-development}

WORKDIR /app

COPY --chown=node:node package*.json ./
COPY --chown=node:node --from=deps /app/node_modules ./node_modules
COPY --chown=node:node . .

RUN NODE_ENV=${NODE_ENV} npm run build
RUN NODE_ENV=${NODE_ENV} npm run build:api

USER node

# Step 3 - Instal dependencies without devDependencies
FROM node:20-alpine3.17 AS modules
LABEL author="Dmitry Neverovski <dmitryneverovski@gmail.com>"

WORKDIR /app

ARG NODE_ENV
ENV NODE_ENV=${NODE_ENV:-development}

WORKDIR /app

COPY --chown=node:node package*.json ./

RUN npm ci --omit=dev --ignore-scripts
Expand All @@ -49,14 +49,10 @@ LABEL author="Dmitry Neverovski <dmitryneverovski@gmail.com>"
ARG APP_PORT
ENV APP_PORT=${APP_PORT:-5656}

WORKDIR /app
USER node

COPY --chown=node:node package*.json ./
COPY --chown=node:node templates ./templates
COPY --chown=node:node --from=modules /app/node_modules ./node_modules
COPY --chown=node:node --from=build /app/dist ./dist
COPY --chown=node:node swagger ./swagger
COPY --chown=node:node templates ./templates

EXPOSE ${APP_PORT}

Expand Down

0 comments on commit b5db370

Please sign in to comment.