-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Don't install dev packages in Docker image (#575)
* add flag to yarn install in docker image * make great dockerfile * remove dev-dependencies stage * apply same update to Debian Dockerfile --------- Co-authored-by: Maciej Tonderski <[email protected]>
- Loading branch information
1 parent
dcbec5d
commit 1765722
Showing
2 changed files
with
19 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,30 @@ | ||
# Base stage | ||
FROM node:18-alpine AS base | ||
|
||
ENV CHROME_BIN="/usr/bin/chromium-browser" | ||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true" | ||
|
||
WORKDIR /usr/src/app | ||
|
||
RUN \ | ||
apk --no-cache upgrade && \ | ||
apk add --no-cache udev ttf-opensans unifont chromium ca-certificates dumb-init && \ | ||
rm -rf /tmp/* | ||
RUN apk --no-cache upgrade && \ | ||
apk add --no-cache udev ttf-opensans unifont chromium ca-certificates dumb-init && \ | ||
rm -rf /tmp/* | ||
|
||
FROM base as build | ||
# Build stage | ||
FROM base AS build | ||
|
||
COPY . ./ | ||
|
||
RUN yarn install --pure-lockfile | ||
RUN yarn run build | ||
|
||
EXPOSE 8081 | ||
# Production dependencies stage | ||
FROM base AS prod-dependencies | ||
|
||
CMD [ "yarn", "run", "dev" ] | ||
COPY package.json yarn.lock ./ | ||
RUN yarn install --pure-lockfile --production | ||
|
||
# Final stage | ||
FROM base | ||
|
||
LABEL maintainer="Grafana team <[email protected]>" | ||
|
@@ -38,7 +42,7 @@ RUN addgroup -S -g $GF_GID grafana && \ | |
|
||
ENV NODE_ENV=production | ||
|
||
COPY --from=build /usr/src/app/node_modules node_modules | ||
COPY --from=prod-dependencies /usr/src/app/node_modules node_modules | ||
COPY --from=build /usr/src/app/build build | ||
COPY --from=build /usr/src/app/proto proto | ||
COPY --from=build /usr/src/app/default.json config.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters