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
1
2
FROM node:18-alpine AS base
2
3
3
4
ENV CHROME_BIN="/usr/bin/chromium-browser"
4
5
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
5
6
6
7
WORKDIR /usr/src/app
7
8
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/*
12
12
13
- FROM base as build
13
+ # Build stage
14
+ FROM base AS build
14
15
15
16
COPY . ./
16
17
17
18
RUN yarn install --pure-lockfile
18
19
RUN yarn run build
19
20
20
- EXPOSE 8081
21
+ # Production dependencies stage
22
+ FROM base AS prod-dependencies
21
23
22
- CMD [ "yarn" , "run" , "dev" ]
24
+ COPY package.json yarn.lock ./
25
+ RUN yarn install --pure-lockfile --production
23
26
27
+ # Final stage
24
28
FROM base
25
29
26
30
LABEL maintainer=
"Grafana team <[email protected] >"
@@ -38,7 +42,7 @@ RUN addgroup -S -g $GF_GID grafana && \
38
42
39
43
ENV NODE_ENV=production
40
44
41
- COPY --from=build /usr/src/app/node_modules node_modules
45
+ COPY --from=prod-dependencies /usr/src/app/node_modules node_modules
42
46
COPY --from=build /usr/src/app/build build
43
47
COPY --from=build /usr/src/app/proto proto
44
48
COPY --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 \
17
17
ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /usr/local/bin/dumb-init
18
18
RUN chmod +x /usr/local/bin/dumb-init
19
19
20
+ # Build stage
20
21
FROM base as build
21
22
22
23
COPY . ./
23
24
24
25
RUN yarn install --pure-lockfile
25
26
RUN yarn run build
26
27
27
- EXPOSE 8081
28
+ # Production dependencies stage
29
+ FROM base AS prod-dependencies
28
30
29
- CMD [ "yarn" , "run" , "dev" ]
31
+ COPY package.json yarn.lock ./
32
+ RUN yarn install --pure-lockfile --production
30
33
34
+ # Final stage
31
35
FROM base
32
36
33
37
ENV NODE_ENV=production
34
38
35
- COPY --from=build /usr/src/app/node_modules node_modules
39
+ COPY --from=prod-dependencies /usr/src/app/node_modules node_modules
36
40
COPY --from=build /usr/src/app/build build
37
41
COPY --from=build /usr/src/app/proto proto
38
42
COPY --from=build /usr/src/app/default.json config.json
You can’t perform that action at this time.
0 commit comments