Skip to content
Snippets Groups Projects
Commit 0550f858 authored by Dmitriy Safronov's avatar Dmitriy Safronov
Browse files

refactor: Dockerfile

parent f62e2f3b
No related branches found
No related tags found
No related merge requests found
...@@ -2,19 +2,16 @@ ...@@ -2,19 +2,16 @@
FROM node:20.13.1 AS builder FROM node:20.13.1 AS builder
ENV NODE_ENV=production ENV NODE_ENV=production
WORKDIR /app WORKDIR /app
# Install NPM with version
RUN npm install -g npm@10.8.0 RUN npm install -g npm@10.8.0
# Install dependencies
COPY package*.json ./
ARG NPM_TOKEN ARG NPM_TOKEN
COPY package*.json ./
RUN echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc && \ RUN echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc && \
npm ci --omit=dev && \ npm ci --omit=dev && \
rm -f .npmrc rm -f .npmrc
# Build app
COPY . . COPY . .
RUN npm run build RUN npm run build
# --------------> The production image # --------------> The production image
FROM nginxinc/nginx-unprivileged:1.26.0 AS production FROM nginxinc/nginx-unprivileged:1.26.0 AS production
# Copy built assets from `builder` image RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /app/build/ /usr/share/nginx/html/ COPY --from=builder /app/build/ /usr/share/nginx/html/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment