Skip to content

Commit 91b642c

Browse files
authored
Merge pull request #6 from oslabs-beta/noahReduceBranch
Noah reduce branch
2 parents 6c9a6e3 + 86ecdb2 commit 91b642c

20 files changed

+28621
-19796
lines changed

Dockerfile

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,57 +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
1413

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

17+
RUN npm install --omit=dev --no-install-recommends --fetch-retry-maxtimeout 500000
1718

18-
RUN npm install --no-install-recommends --fetch-retry-maxtimeout 500000
19+
#yep, we have to copy these.... );
20+
COPY ./index.html ./index.html
21+
#COPY ./app/src/public/styles/style.css ./app/src/public/styles/style.css
22+
COPY ./app/src ./app/src
23+
COPY ./vite.config.ts ./vite.config.ts
24+
COPY ./resources ./resources
25+
COPY ./src ./src
1926

20-
# install vite virst
27+
RUN npm run prod-build
2128

2229

23-
COPY . .
24-
ENV NODE_ENV='production'
25-
# i am hoping the above will make it so that the frontend files will know that it is production.
26-
RUN npm run prod-build
2730

28-
# Stage 2: Runtime
31+
# # Stage 2: Runtime
2932
FROM node:21.2.0-alpine AS runtime
3033

31-
WORKDIR /app
32-
33-
COPY --from=build /app/package*.json ./
34+
WORKDIR /app
3435

35-
RUN npm install --no-install-recommends --fetch-retry-maxtimeout 500000
3636

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

39-
# make a build file?
4039

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

42-
# --only=prod
43-
# COPY --from=build /app/.env .env
44-
COPY --from=build /app/config.js ./config.js
45-
COPY --from=build /app/server ./server
46-
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
4747

48-
# COPY .env .env
49-
#just make the env file go into the docker image?
5048

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

52+
ENV PORT=5656
5253
EXPOSE 5656
5354

5455
ENV IS_DOCKER=true
5556

56-
5757
ENV VIDEOSDK='vidsdk'
5858

59-
ENV PORT=5656
60-
61-
# no longer put the envs here
6259

6360
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" ]

__tests__/componentBuilder.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('componentBuilder', () => {
2525
name: 'input',
2626
childId: 1,
2727
style: {},
28-
attributes: { cssClasses: 'test-class' },
28+
attributes: { cssclasses: 'test-class' },
2929
events: {},
3030
stateProps: [],
3131
passedInProps: [],
@@ -90,7 +90,7 @@ describe('componentBuilder', () => {
9090
name: 'img',
9191
childId: 2,
9292
style: {},
93-
attributes: { compLink: 'http://example.com/image.png' },
93+
attributes: { complink: 'http://example.com/image.png' },
9494
events: {},
9595
stateProps: [],
9696
passedInProps: [],
@@ -113,7 +113,7 @@ describe('componentBuilder', () => {
113113
name: 'div',
114114
childId: 3,
115115
style: {},
116-
attributes: { cssClasses: 'container' },
116+
attributes: { cssclasses: 'container' },
117117
events: {},
118118
stateProps: [],
119119
passedInProps: [],

__tests__/generateCode.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ describe('elementTagDetails', () => {
338338
it('generates correct details for an HTML element', () => {
339339
const childElement = {
340340
childId: '1',
341-
attributes: { cssClasses: 'btn' },
341+
attributes: { cssclasses: 'btn' },
342342
style: {},
343343
events: {}
344344
};

0 commit comments

Comments
 (0)