diff --git a/ai-service/Dockerfile b/ai-service/Dockerfile index 59ac1c81de..ad30d449b4 100644 --- a/ai-service/Dockerfile +++ b/ai-service/Dockerfile @@ -10,8 +10,8 @@ ARG YARN_CACHE_FOLDER=/root/.yarn FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ -# Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +# Here and after. Leverage a cache mount to $YARN_CACHE_FOLDER to speed up subsequent builds +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build common module @@ -20,7 +20,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link common/package.json common/tsconfig*.json yarn.lock ./ COPY --link common/src src/ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install && yarn pack # Stage 3: Installing production dependecies @@ -29,7 +29,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link ai-service/package.json ai-service/tsconfig*.json yarn.lock ./ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 4: Build service @@ -38,7 +38,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/yarn.lock ./ COPY --link ai-service/src src/ -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:prod # Stage 5: Create the final image @@ -53,4 +53,4 @@ COPY --link --from=build /usr/local/app/dist dist/ # Change the user to node USER node -CMD [ "node", "dist/index.js" ] \ No newline at end of file +CMD [ "node", "dist/index.js" ] diff --git a/analytics-service/Dockerfile b/analytics-service/Dockerfile index 6c454d4b98..a6b767b86b 100644 --- a/analytics-service/Dockerfile +++ b/analytics-service/Dockerfile @@ -10,8 +10,8 @@ ARG YARN_CACHE_FOLDER=/root/.yarn FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ -# Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +# Here and after. Leverage a cache mount to $YARN_CACHE_FOLDER to speed up subsequent builds +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build common module @@ -20,7 +20,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link common/package.json common/tsconfig*.json yarn.lock ./ COPY --link common/src src/ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install && yarn pack # Stage 3: Installing production dependecies @@ -29,7 +29,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link analytics-service/package.json analytics-service/tsconfig*.json yarn.lock ./ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 4: Build service @@ -38,7 +38,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/yarn.lock ./ COPY --link analytics-service/src src/ -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:prod # Stage 5: Create the final image @@ -55,4 +55,4 @@ COPY --link --from=build /usr/local/app/dist dist/ # Change the user to node USER node -CMD [ "node", "dist/index.js" ] \ No newline at end of file +CMD [ "node", "dist/index.js" ] diff --git a/api-gateway/Dockerfile b/api-gateway/Dockerfile index 937d56dde3..7528db2f7a 100644 --- a/api-gateway/Dockerfile +++ b/api-gateway/Dockerfile @@ -11,7 +11,7 @@ FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ # Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build common module @@ -20,7 +20,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link common/package.json common/tsconfig*.json yarn.lock ./ COPY --link common/src src/ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install && yarn pack # Stage 3: Installing production dependecies @@ -29,7 +29,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link api-gateway/package.json api-gateway/tsconfig*.json api-gateway/Gulpfile.mjs yarn.lock ./ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 4: Build service @@ -39,7 +39,7 @@ COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/Gulpfile.mjs /usr/local/app/yarn.lock ./ COPY --link api-gateway/environments environments/ COPY --link api-gateway/src src/ -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:prod # Stage 5: Create the final image diff --git a/api-gateway/Dockerfile.demo b/api-gateway/Dockerfile.demo index be27d1c868..adfe092f2c 100644 --- a/api-gateway/Dockerfile.demo +++ b/api-gateway/Dockerfile.demo @@ -11,7 +11,7 @@ FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ # Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build common module @@ -20,7 +20,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link common/package.json common/tsconfig*.json yarn.lock ./ COPY --link common/src src/ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install && yarn pack # Stage 3: Installing production dependecies @@ -29,7 +29,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link api-gateway/package.json api-gateway/tsconfig*.json api-gateway/Gulpfile.mjs yarn.lock ./ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 4: Build service @@ -39,7 +39,7 @@ COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/Gulpfile.mjs /usr/local/app/yarn.lock ./ COPY --link api-gateway/environments environments/ COPY --link api-gateway/src src/ -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:demo # Stage 5: Create the final image diff --git a/application-events/Dockerfile b/application-events/Dockerfile index 2c45a3fb9a..7c05c3a91e 100644 --- a/application-events/Dockerfile +++ b/application-events/Dockerfile @@ -11,7 +11,7 @@ FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ # Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build common module @@ -20,7 +20,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link common/package.json common/tsconfig*.json yarn.lock ./ COPY --link common/src src/ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install && yarn pack # Stage 3: Installing production dependecies @@ -29,7 +29,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link application-events/package.json application-events/tsconfig*.json yarn.lock ./ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 4: Build service @@ -38,7 +38,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/yarn.lock ./ COPY --link application-events/src src/ -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:prod # Stage 5: Create the final image @@ -56,4 +56,4 @@ COPY --link --from=build /usr/local/app/dist dist/ # Change the user to node USER node -CMD [ "node", "dist/index.js" ] \ No newline at end of file +CMD [ "node", "dist/index.js" ] diff --git a/auth-service/Dockerfile b/auth-service/Dockerfile index 463d367e22..e906bdd1b4 100644 --- a/auth-service/Dockerfile +++ b/auth-service/Dockerfile @@ -11,7 +11,7 @@ FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ # Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build common module @@ -20,7 +20,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link common/package.json common/tsconfig*.json yarn.lock ./ COPY --link common/src src/ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install && yarn pack # Stage 3: Installing production dependecies @@ -29,7 +29,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link auth-service/package.json auth-service/tsconfig*.json auth-service/Gulpfile.mjs yarn.lock ./ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 4: Build service @@ -39,7 +39,7 @@ COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/Gulpfile.mjs /usr/local/app/yarn.lock ./ COPY --link auth-service/environments environments/ COPY --link auth-service/src src/ -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:prod # Stage 5: Create the final image diff --git a/auth-service/Dockerfile.demo b/auth-service/Dockerfile.demo index 7c1acbf224..f54260c012 100644 --- a/auth-service/Dockerfile.demo +++ b/auth-service/Dockerfile.demo @@ -11,7 +11,7 @@ FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ # Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build common module @@ -20,7 +20,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link common/package.json common/tsconfig*.json yarn.lock ./ COPY --link common/src src/ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install && yarn pack # Stage 3: Installing production dependecies @@ -29,7 +29,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link auth-service/package.json auth-service/tsconfig*.json auth-service/Gulpfile.mjs yarn.lock ./ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 4: Build service @@ -39,7 +39,7 @@ COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/Gulpfile.mjs /usr/local/app/yarn.lock ./ COPY --link auth-service/environments environments/ COPY --link auth-service/src src/ -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:demo # Stage 5: Create the final image diff --git a/guardian-service/Dockerfile b/guardian-service/Dockerfile index 8188f79ea3..324e4414a5 100644 --- a/guardian-service/Dockerfile +++ b/guardian-service/Dockerfile @@ -11,7 +11,7 @@ FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ # Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build common module @@ -20,7 +20,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link common/package.json common/tsconfig*.json yarn.lock ./ COPY --link common/src src/ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install && yarn pack # Stage 3: Installing production dependecies @@ -29,7 +29,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link guardian-service/package.json guardian-service/tsconfig*.json yarn.lock ./ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 4: Build service @@ -38,7 +38,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/yarn.lock ./ COPY --link guardian-service/src src/ -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:prod # Stage 5: Create the final image @@ -57,4 +57,4 @@ COPY --link --from=build /usr/local/app/dist dist/ # Change the user to node USER node -CMD [ "node", "dist/index.js" ] \ No newline at end of file +CMD [ "node", "dist/index.js" ] diff --git a/logger-service/Dockerfile b/logger-service/Dockerfile index b2ef0eabbe..989e530835 100644 --- a/logger-service/Dockerfile +++ b/logger-service/Dockerfile @@ -11,7 +11,7 @@ FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ # Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build common module @@ -20,7 +20,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link common/package.json common/tsconfig*.json yarn.lock ./ COPY --link common/src src/ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install && yarn pack # Stage 3: Installing production dependecies @@ -29,7 +29,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link logger-service/package.json logger-service/tsconfig*.json yarn.lock ./ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 4: Build service @@ -38,7 +38,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/yarn.lock ./ COPY --link logger-service/src src/ -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:prod # Stage 5: Create the final image @@ -54,4 +54,4 @@ RUN mkdir -p /usr/local/app/dist/migrations # Change the user to node USER node -CMD [ "node", "dist/index.js" ] \ No newline at end of file +CMD [ "node", "dist/index.js" ] diff --git a/mrv-sender/Dockerfile b/mrv-sender/Dockerfile index 7d705a1975..d3db4f022b 100644 --- a/mrv-sender/Dockerfile +++ b/mrv-sender/Dockerfile @@ -11,7 +11,7 @@ FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ # Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build common module @@ -20,7 +20,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link common/package.json common/tsconfig*.json yarn.lock ./ COPY --link common/src src/ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install && yarn pack # Stage 3: Installing production dependecies @@ -29,7 +29,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link mrv-sender/package.json mrv-sender/tsconfig*.json yarn.lock ./ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 4: Build service @@ -38,7 +38,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/yarn.lock ./ COPY --link mrv-sender/src src/ -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:prod # Stage 5: Create the final image @@ -55,4 +55,4 @@ COPY --link --from=build /usr/local/app/dist dist/ # Change the user to node USER node -CMD [ "node", "dist/index.js" ] \ No newline at end of file +CMD [ "node", "dist/index.js" ] diff --git a/notification-service/Dockerfile b/notification-service/Dockerfile index 8db3708ca1..b1d912a6b8 100644 --- a/notification-service/Dockerfile +++ b/notification-service/Dockerfile @@ -11,7 +11,7 @@ FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ # Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build common module @@ -20,7 +20,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link common/package.json common/tsconfig*.json yarn.lock ./ COPY --link common/src src/ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install && yarn pack # Stage 3: Installing production dependecies @@ -29,7 +29,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link notification-service/package.json notification-service/tsconfig*.json yarn.lock ./ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 4: Build service @@ -38,7 +38,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/yarn.lock ./ COPY --link notification-service/src src/ -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:prod # Stage 5: Create the final image @@ -54,4 +54,4 @@ RUN mkdir -p /usr/local/app/dist/migrations # Change the user to node USER node -CMD [ "node", "dist/index.js" ] \ No newline at end of file +CMD [ "node", "dist/index.js" ] diff --git a/policy-service/Dockerfile b/policy-service/Dockerfile index 508e30605c..924ca11cf0 100644 --- a/policy-service/Dockerfile +++ b/policy-service/Dockerfile @@ -11,7 +11,7 @@ FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ # Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build common module @@ -20,7 +20,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link common/package.json common/tsconfig*.json yarn.lock ./ COPY --link common/src src/ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install && yarn pack # Stage 3: Installing production dependecies @@ -29,7 +29,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link policy-service/package.json policy-service/tsconfig*.json yarn.lock ./ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 4: Build service @@ -38,7 +38,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/yarn.lock ./ COPY --link policy-service/src src/ -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:prod # Stage 5: Create the final image @@ -53,4 +53,4 @@ COPY --link --from=build /usr/local/app/dist dist/ # Change the user to node USER node -CMD [ "node", "dist/index.js" ] \ No newline at end of file +CMD [ "node", "dist/index.js" ] diff --git a/topic-viewer/Dockerfile b/topic-viewer/Dockerfile index 19b30ed1d4..a0155a0d3b 100644 --- a/topic-viewer/Dockerfile +++ b/topic-viewer/Dockerfile @@ -10,14 +10,14 @@ ARG YARN_CACHE_FOLDER=/root/.yarn FROM base as deps COPY --link topic-viewer/package.json topic-viewer/tsconfig*.json yarn.lock ./ # Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 2: Build service FROM base as build COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/yarn.lock ./ COPY --link topic-viewer/src src/ -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:prod # Stage 3: Create the final image @@ -34,4 +34,4 @@ COPY --link --from=build /usr/local/app/dist dist/ # Change the user to node USER node -CMD [ "node", "dist/index.js" ] \ No newline at end of file +CMD [ "node", "dist/index.js" ] diff --git a/tree-viewer/Dockerfile b/tree-viewer/Dockerfile index e57e3776c0..e03b3de156 100644 --- a/tree-viewer/Dockerfile +++ b/tree-viewer/Dockerfile @@ -10,14 +10,14 @@ ARG YARN_CACHE_FOLDER=/root/.yarn FROM base as deps COPY --link tree-viewer/package.json tree-viewer/tsconfig*.json yarn.lock ./ # Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 2: Build service FROM base as build COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/yarn.lock ./ COPY --link tree-viewer/src src/ -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:prod # Stage 3: Create the final image @@ -34,4 +34,4 @@ COPY --link --from=build /usr/local/app/dist dist/ # Change the user to node USER node -CMD [ "node", "dist/index.js" ] \ No newline at end of file +CMD [ "node", "dist/index.js" ] diff --git a/web-proxy/Dockerfile b/web-proxy/Dockerfile index 14208d1e99..3751a028ac 100644 --- a/web-proxy/Dockerfile +++ b/web-proxy/Dockerfile @@ -11,7 +11,7 @@ FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ # Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build frontend @@ -31,4 +31,4 @@ COPY --link --from=build /usr/local/app/dist/guardian /usr/share/nginx/html # Change the user to nginx USER nginx -EXPOSE 80 \ No newline at end of file +EXPOSE 80 diff --git a/web-proxy/Dockerfile.ci b/web-proxy/Dockerfile.ci index a5a7b3c666..7ca03eede5 100644 --- a/web-proxy/Dockerfile.ci +++ b/web-proxy/Dockerfile.ci @@ -11,7 +11,7 @@ FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ # Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build frontend @@ -31,4 +31,4 @@ COPY --link --from=build /usr/local/app/dist/guardian /usr/share/nginx/html # Change the user to nginx USER nginx -EXPOSE 80 \ No newline at end of file +EXPOSE 80 diff --git a/web-proxy/Dockerfile.demo b/web-proxy/Dockerfile.demo index c729eec869..b8e2c8a33d 100644 --- a/web-proxy/Dockerfile.demo +++ b/web-proxy/Dockerfile.demo @@ -11,7 +11,7 @@ FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ # Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build frontend @@ -31,4 +31,4 @@ COPY --link --from=build /usr/local/app/dist/guardian /usr/share/nginx/html # Change the user to nginx USER nginx -EXPOSE 80 \ No newline at end of file +EXPOSE 80 diff --git a/worker-service/Dockerfile b/worker-service/Dockerfile index f8550205bf..086ef7f236 100644 --- a/worker-service/Dockerfile +++ b/worker-service/Dockerfile @@ -11,7 +11,7 @@ FROM base as interfaces COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./ COPY --link interfaces/src src/ # Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn pack # Stage 2: Build common module @@ -20,7 +20,7 @@ COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/inte COPY --link common/package.json common/tsconfig*.json yarn.lock ./ COPY --link common/src src/ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install && yarn pack # Stage 3: Installing production dependecies @@ -30,7 +30,7 @@ COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link worker-service/package.json worker-service/tsconfig*.json yarn.lock ./ RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));" RUN apk add --no-cache git -RUN --mount=type=cache,target=/root/.yarn,sharing=private \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --prod # Stage 4: Build service @@ -40,7 +40,7 @@ COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/yarn.lock ./ COPY --link worker-service/src src/ RUN apk add --no-cache git -RUN --mount=type=cache,target=/root/.yarn \ +RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,sharing=private \ yarn install --frozen-lockfile && yarn run build:prod # Stage 5: Create the final image @@ -55,4 +55,4 @@ COPY --link --from=build /usr/local/app/dist dist/ # Change the user to node USER node -CMD [ "node", "dist/index.js" ] \ No newline at end of file +CMD [ "node", "dist/index.js" ]