Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] frontend: update Dockerfile to reduce final image size by 15% #2017

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

FROM node:20-alpine AS deps
FROM node:20-alpine AS builder
RUN apk add --no-cache libc6-compat

USER node

WORKDIR /app

COPY ./src/frontend/package*.json ./
RUN npm ci

FROM node:20-alpine AS builder
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
RUN npm clean-install --no-audit --no-progress
COPY ./src/frontend/protos ./protos
COPY ./src/frontend .

RUN npm run build

FROM node:20-alpine AS deps

USER node

WORKDIR /app
COPY --chown=node:node --from=builder /home/node/.npm/ /home/node/.npm/
COPY ./src/frontend/package*.json ./
RUN NODE_ENV=production npm clean-install --prefer-offline --no-audit --no-progress


FROM node:20-alpine AS runner
WORKDIR /app

Expand Down
Loading