forked from open-source-labs/ReacType
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
73 lines (45 loc) · 1.86 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Stage 1: Install
FROM node:21.2.0-alpine AS installation
# this at a least keeps the packageloc out of the build stage.
COPY package*.json ./
# we do need this.
RUN npm install --omit=dev --no-install-recommends --fetch-retry-maxtimeout 500000
# Stage 1: Build
FROM node:21.2.0-alpine AS build
# python: required dependency for node alpine, shrinks image size from 2.17GB to 1.67GB
# 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 streamlining the dockerfile logic.
# RUN apk add --no-cache --virtual .gyp \
# python3 \
# make \
# g++
ENV NODE_ENV='production'
# we can just copy this for savings in build stage ram cap?
COPY --from=installation ./node_modules ./node_modules
#yep, we have to copy these.... );
COPY ./index.html ./index.html
#COPY ./app/src/public/styles/style.css ./app/src/public/styles/style.css
COPY ./app/src ./app/src
COPY ./vite.config.ts ./vite.config.ts
COPY ./resources ./resources
COPY ./src ./src
# we need the package.json, but hopefully, not the pacakge lock.
COPY ./package.json ./
RUN npm run prod-build
# as a note, this is much easier for CI/CD, but we could deploy with the build folder part of the zip, which would remove the need for this step.s
# # Stage 2: Runtime
FROM node:21.2.0-alpine AS runtime
WORKDIR /app
COPY --from=build /build /app/build
# just copy this straight if we can?
COPY ../server ./server
# these things build dosent have so dont copy them through
COPY package*.json ./
#COPY .env .env
COPY ./config.js ./config.js
# and now we need to copy a bunch of stuff.
COPY --from=build ./node_modules ./node_modules
ENV PORT=5656
EXPOSE 5656
ENV IS_DOCKER=true
ENV VIDEOSDK='vidsdk'
CMD [ "npm", "start" ]