Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install application dependencies during the image build #335

Merged
merged 1 commit into from
May 30, 2018

Conversation

sameersbn
Copy link
Contributor

fixes #332

@@ -1,5 +1,9 @@
FROM node:8.9 AS build
WORKDIR /app

COPY package.json yarn.lock /app/
RUN yarn install --frozen-lockfile
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This improves docker cache hits in the development workflow

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean with "this"? the --frozen-lockfile? Why not doing the yarn install after the COPY . /app?

Copy link
Contributor Author

@sameersbn sameersbn May 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the --frozen-lockfile?

Apparently yarn install could go an update the yarn.lock file and update the package versions to something completely different from what it was tested against. For this reason the --frozen-lockfile is recommended for use in CI builds yarnpkg/yarn#749

Why not doing the yarn install after the COPY . /app?

Specifically w.r.t the developer use-case, this ensures that the docker layer cache gets reused during the builds. As a result image builds will be quicker when the dashboard sources (css/js/ts/etc) are updated. Only when there are updates to the package.json/yarn.lock file, there will be a cache miss and yarn install will execute again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, true

@sameersbn sameersbn requested a review from prydonius May 30, 2018 09:59
@sameersbn sameersbn force-pushed the fix-dashboard-dockerfile branch from 3495367 to 237da38 Compare May 30, 2018 10:43
@@ -1,5 +1,9 @@
FROM node:8.9 AS build
WORKDIR /app

COPY package.json yarn.lock /app/
RUN yarn install --frozen-lockfile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, true

@prydonius prydonius merged commit 9c72af4 into vmware-tanzu:master May 30, 2018
@sameersbn sameersbn deleted the fix-dashboard-dockerfile branch June 1, 2018 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dockerfile for dashboard does not include yarn install
3 participants