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

Shrink image another 20MB with separate node_modules ci --omit=dev stage #244

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# docker build -t node -f ./Dockerfile .

# syntax=docker/dockerfile:1.11
FROM node:lts-alpine AS builder

Expand All @@ -13,6 +15,14 @@ RUN npm ci
COPY . .
RUN npm run build

# Node_Modules stage
FROM node:lts-alpine AS modules

WORKDIR /veritable-ui

COPY package*.json ./
RUN npm ci --omit=dev

# Test stage
FROM node:current-bookworm-slim AS test

Expand Down Expand Up @@ -42,12 +52,11 @@ WORKDIR /veritable-ui
RUN apk add --no-cache coreutils curl
RUN npm -g install [email protected]

COPY package*.json ./
RUN npm ci --omit=dev

COPY public ./public
COPY knexfile.js ./
COPY --from=builder /veritable-ui/package*.json ./
COPY --from=builder /veritable-ui/build ./build
COPY --from=modules /veritable-ui/node_modules ./node_modules

HEALTHCHECK --interval=30s --timeout=20s \
CMD curl -f http://localhost:3000/health || exit 1
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "veritable-ui",
"version": "0.14.20",
"version": "0.14.21",
"description": "UI for Veritable",
"main": "src/index.ts",
"type": "module",
Expand Down