File tree Expand file tree Collapse file tree 2 files changed +19
-11
lines changed
Expand file tree Collapse file tree 2 files changed +19
-11
lines changed Original file line number Diff line number Diff line change 1+ # Base stage
12FROM node:18-alpine AS base
23
34ENV CHROME_BIN="/usr/bin/chromium-browser"
45ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
56
67WORKDIR /usr/src/app
78
8- RUN \
9- apk --no-cache upgrade && \
10- apk add --no-cache udev ttf-opensans unifont chromium ca-certificates dumb-init && \
11- rm -rf /tmp/*
9+ RUN apk --no-cache upgrade && \
10+ apk add --no-cache udev ttf-opensans unifont chromium ca-certificates dumb-init && \
11+ rm -rf /tmp/*
1212
13- FROM base as build
13+ # Build stage
14+ FROM base AS build
1415
1516COPY . ./
1617
1718RUN yarn install --pure-lockfile
1819RUN yarn run build
1920
20- EXPOSE 8081
21+ # Production dependencies stage
22+ FROM base AS prod-dependencies
2123
22- CMD [ "yarn" , "run" , "dev" ]
24+ COPY package.json yarn.lock ./
25+ RUN yarn install --pure-lockfile --production
2326
27+ # Final stage
2428FROM base
2529
2630LABEL maintainer=
"Grafana team <[email protected] >" @@ -38,7 +42,7 @@ RUN addgroup -S -g $GF_GID grafana && \
3842
3943ENV NODE_ENV=production
4044
41- COPY --from=build /usr/src/app/node_modules node_modules
45+ COPY --from=prod-dependencies /usr/src/app/node_modules node_modules
4246COPY --from=build /usr/src/app/build build
4347COPY --from=build /usr/src/app/proto proto
4448COPY --from=build /usr/src/app/default.json config.json
Original file line number Diff line number Diff line change @@ -17,22 +17,26 @@ RUN apt-get install -y wget gnupg \
1717ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /usr/local/bin/dumb-init
1818RUN chmod +x /usr/local/bin/dumb-init
1919
20+ # Build stage
2021FROM base as build
2122
2223COPY . ./
2324
2425RUN yarn install --pure-lockfile
2526RUN yarn run build
2627
27- EXPOSE 8081
28+ # Production dependencies stage
29+ FROM base AS prod-dependencies
2830
29- CMD [ "yarn" , "run" , "dev" ]
31+ COPY package.json yarn.lock ./
32+ RUN yarn install --pure-lockfile --production
3033
34+ # Final stage
3135FROM base
3236
3337ENV NODE_ENV=production
3438
35- COPY --from=build /usr/src/app/node_modules node_modules
39+ COPY --from=prod-dependencies /usr/src/app/node_modules node_modules
3640COPY --from=build /usr/src/app/build build
3741COPY --from=build /usr/src/app/proto proto
3842COPY --from=build /usr/src/app/default.json config.json
You can’t perform that action at this time.
0 commit comments