Skip to content

Commit

Permalink
Fixes #3712;
Browse files Browse the repository at this point in the history
Signed-off-by: Giuseppe Bertone <[email protected]>
  • Loading branch information
Neurone committed Aug 9, 2024
1 parent 7c3716d commit 01b023d
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 73 deletions.
12 changes: 6 additions & 6 deletions ai-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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" ]
CMD [ "node", "dist/index.js" ]
12 changes: 6 additions & 6 deletions analytics-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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" ]
CMD [ "node", "dist/index.js" ]
8 changes: 4 additions & 4 deletions api-gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions api-gateway/Dockerfile.demo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions application-events/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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" ]
CMD [ "node", "dist/index.js" ]
8 changes: 4 additions & 4 deletions auth-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions auth-service/Dockerfile.demo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions guardian-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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" ]
CMD [ "node", "dist/index.js" ]
Loading

0 comments on commit 01b023d

Please sign in to comment.