guardian icon indicating copy to clipboard operation
guardian copied to clipboard

`YARN_CACHE_FOLDER` in Dockerfile is not actually used

Open Neurone opened this issue 1 year ago • 0 comments

Problem description

The YARN_CACHE_FOLDER is defined in the services' Dockerfile but it's not actually used during the build process. This prevents the correct overriding of that variable from the outside CLI. This happens for all the services.

Side note: for some reason, while building on MacOS using /root/.yarn as ID of the cache results in errors during the building of the services. Overriding that variable with any other ID, e.g., /root/yarn allows the build process to finish correctly.

Step to reproduce

Steps to reproduce the behavior:

  1. Run the build process for any service, e.g., the logger-service, using:

docker compose build logger-service

  1. Check the line

=> CACHED [logger-service interfaces 3/3] RUN --mount=type=cache,target=/root/.yarn yarn install --frozen-lockfile && yarn pack

and verify the target is set to the default value /root/.yarn

  1. Run the build process overriding the YARN_CACHE_FOLDER variable:

docker compose build logger-service --build-arg YARN_CACHE_FOLDER=/root/yarn

  1. Check the target is still /root/.yarn

=> CACHED [logger-service interfaces 3/3] RUN --mount=type=cache,target=/root/.yarn yarn install --frozen-lockfile && yarn pack

Expected behavior

The value of the target changes accordingly to the YARN_CACHE_FOLDER variable's value.

Screenshots

N/A

Neurone avatar May 28 '24 16:05 Neurone