altinn-studio icon indicating copy to clipboard operation
altinn-studio copied to clipboard

Caching yarn packages when building the Docker image

Open mlqn opened this issue 1 year ago • 0 comments

Description

Our current Docker image downloads all yarn packages each time a new build occurs (new commit, new deployment, etc).

I suggest caching yarn packages by copying our package.json and yarn.lock files in a separate command. This should considerably reduce the build time of the Docker image.

Here is an example of a possible solution:

COPY ./package.json yarn.lock ./
...
RUN corepack enable
RUN yarn --immutable

COPY . .
RUN yarn build

https://docs.docker.com/build/cache/

Additional Information

No response

Tasks

No response

Acceptance Criterias

No response

mlqn avatar Feb 23 '24 17:02 mlqn