Skip to content

Commit 6cf0c17

Browse files
committed
maybe this will work on 1g
1 parent 86ecdb2 commit 6cf0c17

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
build/*

Dockerfile

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
1+
# Stage 1: Install
2+
FROM node:21.2.0-alpine AS installation
3+
4+
# this at a least keeps the packageloc out of the build stage.
5+
COPY package*.json ./
6+
# we do need this.
7+
8+
RUN npm install --omit=dev --no-install-recommends --fetch-retry-maxtimeout 500000
9+
10+
11+
12+
113
# Stage 1: Build
214
FROM node:21.2.0-alpine AS build
315

416
# python: required dependency for node alpine, shrinks image size from 2.17GB to 1.67GB
5-
RUN apk add --no-cache --virtual .gyp \
6-
python3 \
7-
make \
8-
g++
17+
# as of the v22 team, this does nothing to help the package size, and is not needed, prior to v22, the package size grew to > 3 GB,but the v22 team got it down to 1.48Gb by streamliging the dockerfile logic.
18+
# RUN apk add --no-cache --virtual .gyp \
19+
# python3 \
20+
# make \
21+
# g++
922

1023
ENV NODE_ENV='production'
1124

1225

26+
# we can just copy this for savings in build stage ram cap?
27+
COPY --from=installation ./node_modules ./node_modules
1328

14-
COPY package*.json ./
15-
# we do need this.
16-
17-
RUN npm install --omit=dev --no-install-recommends --fetch-retry-maxtimeout 500000
1829

1930
#yep, we have to copy these.... );
2031
COPY ./index.html ./index.html
@@ -23,6 +34,8 @@ COPY ./app/src ./app/src
2334
COPY ./vite.config.ts ./vite.config.ts
2435
COPY ./resources ./resources
2536
COPY ./src ./src
37+
# we need the package.json, but hopefully, not the pacakge lock.
38+
COPY ./package.json ./
2639

2740
RUN npm run prod-build
2841

0 commit comments

Comments
 (0)