1
- FROM node:18.15.0-alpine as front
1
+ FROM node:18.15.0-alpine as build
2
2
RUN apk update
3
3
RUN apk add --no-cache --virtual .gyp \
4
4
python3 \
5
5
make \
6
- g++
6
+ g++ \
7
+ net-tools
7
8
WORKDIR /usr/src/app
8
9
COPY package.json yarn.lock babel.config.cjs tsconfig.json ./
9
10
RUN SKIP_POSTINSTALL=1 yarn install
10
11
COPY configs ./configs
11
12
COPY scripts ./scripts
12
13
COPY redisinsight ./redisinsight
13
- RUN yarn --cwd redisinsight/api
14
+ RUN yarn --cwd redisinsight/api install
14
15
ARG SERVER_TLS_CERT
15
16
ARG SERVER_TLS_KEY
16
17
ARG SEGMENT_WRITE_KEY
@@ -19,15 +20,10 @@ ENV SERVER_TLS_KEY=${SERVER_TLS_KEY}
19
20
ENV SEGMENT_WRITE_KEY=${SEGMENT_WRITE_KEY}
20
21
RUN yarn build:web
21
22
RUN yarn build:statics
22
-
23
- FROM node:18.15.0-alpine as back
24
- WORKDIR /usr/src/app
25
- COPY redisinsight/api/package.json redisinsight/api/yarn.lock ./
26
- RUN yarn install
27
- COPY redisinsight/api ./
28
- COPY --from=front /usr/src/app/redisinsight/api/static ./static
29
- COPY --from=front /usr/src/app/redisinsight/api/defaults ./defaults
30
- RUN yarn run build:prod
23
+ RUN yarn build:prod
24
+ RUN yarn --cwd ./redisinsight/api install --production
25
+ COPY ./redisinsight/api/.yarnclean.prod ./redisinsight/api/.yarnclean
26
+ RUN yarn --cwd ./redisinsight/api autoclean --force
31
27
32
28
FROM node:18.15.0-alpine
33
29
@@ -42,14 +38,9 @@ ENV NODE_ENV=${NODE_ENV}
42
38
ENV SERVER_STATIC_CONTENT=true
43
39
ENV BUILD_TYPE='DOCKER_ON_PREMISE'
44
40
WORKDIR /usr/src/app
45
- COPY --from=back /usr/src/app/dist ./redisinsight/api/dist
46
- COPY --from=front /usr/src/app/redisinsight/ui/dist ./redisinsight/ui/dist
47
-
48
- # Build BE prod dependencies here to build native modules
49
- COPY redisinsight/api/package.json redisinsight/api/yarn.lock ./redisinsight/api/
50
- RUN yarn --cwd ./redisinsight/api install --production
51
- COPY redisinsight/api/.yarnclean.prod ./redisinsight/api/.yarnclean
52
- RUN yarn --cwd ./redisinsight/api autoclean --force
41
+ COPY --from=build /usr/src/app/redisinsight/api/dist ./redisinsight/api/dist
42
+ COPY --from=build /usr/src/app/redisinsight/api/node_modules ./redisinsight/api/node_modules
43
+ COPY --from=build /usr/src/app/redisinsight/ui/dist ./redisinsight/ui/dist
53
44
54
45
COPY ./docker-entry.sh ./
55
46
RUN chmod +x docker-entry.sh
0 commit comments