altinn-studio
altinn-studio copied to clipboard
Caching yarn packages when building the Docker image
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