-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (31 loc) · 1.33 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
# Production build of React UI
FROM node:22-alpine AS build_ui
WORKDIR /usr/src/app
COPY --chown=node:node views/interactivity/package.json views/interactivity/yarn.lock .
RUN yarn install --frozen-lockfile
COPY --chown=node:node views/interactivity/ .
RUN yarn build
ENV NODE_ENV=production
RUN yarn install --frozen-lockfile --production && yarn cache clean
USER node
# Production build of Backend
FROM node:22-alpine AS build_backend
WORKDIR /usr/src/app
COPY --chown=node:node package.json yarn.lock .
RUN yarn install --frozen-lockfile
COPY --chown=node:node . .
RUN yarn build
ENV NODE_ENV=production
RUN yarn install --frozen-lockfile --production && yarn cache clean
USER node
# Production
FROM node:22-alpine AS production
WORKDIR /app
COPY --chown=node:node --from=build_ui /usr/src/app/build/static/js ./public/js
COPY --chown=node:node --from=build_ui /usr/src/app/build/static/css ./public/css
COPY --chown=node:node --from=build_ui /usr/src/app/build/static/media ./public/media
COPY --chown=node:node --from=build_ui /usr/src/app/build/asset-manifest.json ./public/
COPY --chown=node:node --from=build_backend /usr/src/app/node_modules ./node_modules
COPY --chown=node:node --from=build_backend /usr/src/app/dist ./dist
COPY --chown=node:node --from=build_backend /usr/src/app/views/index.hbs ./views/
CMD [ "node", "dist/main" ]