Skip to content

Commit ec5618e

Browse files
committed
massively reduce dockerfile size
1 parent 1c5b6dc commit ec5618e

File tree

5 files changed

+24297
-17185
lines changed

5 files changed

+24297
-17185
lines changed

Dockerfile

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,73 +7,54 @@ RUN apk add --no-cache --virtual .gyp \
77
make \
88
g++
99

10-
RUN npm install -g [email protected]
10+
ENV NODE_ENV='production'
1111

1212

13-
WORKDIR /app
14-
15-
COPY package*.json ./
16-
# also make the below copies for the runtime stage to use.
17-
COPY ./config.js ./config.js
18-
COPY ./server ./server
1913

14+
COPY package*.json ./
15+
# we do need this.
2016

21-
RUN npm install --production --no-install-recommends --fetch-retry-maxtimeout 500000
22-
23-
# install vite virst
24-
17+
RUN npm install --omit=dev --no-install-recommends --fetch-retry-maxtimeout 500000
2518

19+
#yep, we have to copy these.... );
2620
COPY ./index.html ./index.html
2721
#COPY ./app/src/public/styles/style.css ./app/src/public/styles/style.css
2822
COPY ./app/src ./app/src
2923
COPY ./vite.config.ts ./vite.config.ts
3024
COPY ./resources ./resources
3125
COPY ./src ./src
3226

33-
34-
#also copy this one file lol.
35-
36-
ENV NODE_ENV='production'
37-
# i am hoping the above will make it so that the frontend files will know that it is production.
3827
RUN npm run prod-build
3928

4029

41-
#COPY ./build ./build
42-
# they will need the above.
4330

44-
# Stage 2: Runtime
31+
# # Stage 2: Runtime
4532
FROM node:21.2.0-alpine AS runtime
4633

47-
WORKDIR /app
48-
49-
COPY --from=build /app/package*.json ./
34+
WORKDIR /app
5035

51-
RUN npm install --production --no-install-recommends --fetch-retry-maxtimeout 500000
5236

53-
# RUN npm run dev-frontend # no, dont just run the app while building
37+
COPY --from=build /build /app/build
5438

55-
# make a build file?
5639

40+
# just copy this straight if we can?
41+
COPY ../server ./server
5742

58-
# --only=prod
59-
# COPY --from=build /app/.env .env
60-
COPY --from=build /app/config.js ./config.js
61-
COPY --from=build /app/server ./server
62-
COPY --from=build /app/build /app/build
43+
# these things build dosent have so dont copy them through
44+
COPY package*.json ./
45+
COPY .env .env
46+
COPY ./config.js ./config.js
6347

64-
COPY .env .env
65-
#just make the env file go into the docker image?
6648

49+
# and now we need to copy a bunch of stuff.
50+
COPY --from=build ./node_modules ./node_modules
6751

52+
ENV PORT=5656
6853
EXPOSE 5656
6954

7055
ENV IS_DOCKER=true
7156

72-
7357
ENV VIDEOSDK='vidsdk'
7458

75-
ENV PORT=5656
76-
77-
# no longer put the envs here
7859

7960
CMD [ "npm", "start" ]

Dockerfile-old

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Stage 1: Build
2+
FROM node:21.2.0-alpine AS build
3+
4+
# 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++
9+
10+
RUN npm install -g [email protected]
11+
12+
13+
WORKDIR /app
14+
15+
COPY package*.json ./
16+
# also make the below copies for the runtime stage to use.
17+
COPY ./config.js ./config.js
18+
COPY ./server ./server
19+
20+
21+
RUN npm install --production --no-install-recommends --fetch-retry-maxtimeout 500000
22+
23+
# install vite virst
24+
25+
26+
COPY ./index.html ./index.html
27+
#COPY ./app/src/public/styles/style.css ./app/src/public/styles/style.css
28+
COPY ./app/src ./app/src
29+
COPY ./vite.config.ts ./vite.config.ts
30+
COPY ./resources ./resources
31+
COPY ./src ./src
32+
33+
34+
#also copy this one file lol.
35+
36+
ENV NODE_ENV='production'
37+
# i am hoping the above will make it so that the frontend files will know that it is production.
38+
RUN npm run prod-build
39+
40+
41+
#COPY ./build ./build
42+
# they will need the above.
43+
44+
# Stage 2: Runtime
45+
FROM node:21.2.0-alpine AS runtime
46+
47+
WORKDIR /app
48+
49+
COPY --from=build /app/package*.json ./
50+
51+
RUN npm install --production --no-install-recommends --fetch-retry-maxtimeout 500000
52+
53+
# RUN npm run dev-frontend # no, dont just run the app while building
54+
55+
# make a build file?
56+
57+
58+
# --only=prod
59+
# COPY --from=build /app/.env .env
60+
COPY --from=build /app/config.js ./config.js
61+
COPY --from=build /app/server ./server
62+
COPY --from=build /app/build /app/build
63+
64+
COPY .env .env
65+
#just make the env file go into the docker image?
66+
67+
68+
EXPOSE 5656
69+
70+
ENV IS_DOCKER=true
71+
72+
73+
ENV VIDEOSDK='vidsdk'
74+
75+
ENV PORT=5656
76+
77+
# no longer put the envs here
78+
79+
CMD [ "npm", "start" ]

app/src/components/ContextMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BreakfastDiningOutlined } from '@mui/icons-material';
1+
// import { BreakfastDiningOutlined } from '@mui/icons-material';
22
import React, { useState, useEffect, useRef } from 'react';
33
import { useDispatch, useSelector } from 'react-redux';
44
/* eslint-disable */

0 commit comments

Comments
 (0)