From 6d979d7edd5bf071f5559a830b8369880c336e81 Mon Sep 17 00:00:00 2001 From: VGau Date: Mon, 14 Oct 2024 16:55:54 +0200 Subject: [PATCH 1/4] fix: optimize postman docker build --- sdk/Dockerfile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sdk/Dockerfile b/sdk/Dockerfile index fc733355c..f311ce375 100644 --- a/sdk/Dockerfile +++ b/sdk/Dockerfile @@ -5,6 +5,8 @@ ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable +RUN apt-get update && apt-get install -y --no-install-recommends python3 ca-certificates bash curl make g++ + FROM base AS builder WORKDIR /usr/src/app @@ -16,10 +18,7 @@ COPY package.json pnpm-lock.yaml pnpm-workspace.yaml tsconfig.json ./ COPY ./sdk/package.json ./sdk/package.json COPY ./ts-libs/linea-native-libs/package.json ./ts-libs/linea-native-libs/package.json -RUN --mount=type=cache,id=pnpm,target=/pnpm/store apt-get update && apt-get install -y --no-install-recommends python3 ca-certificates bash curl make g++ \ - && pnpm install --frozen-lockfile --prefer-offline --ignore-scripts \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --prefer-offline --ignore-scripts COPY ./sdk ./sdk COPY ts-libs/linea-native-libs ./ts-libs/linea-native-libs @@ -27,7 +26,7 @@ COPY ts-libs/linea-native-libs ./ts-libs/linea-native-libs RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm run build \ && pnpm deploy --filter=./sdk --prod ./prod/sdk -FROM base AS production +FROM node:lts-slim AS production ENV NODE_ENV=production From d29ef3e07c1213153a49f414f6fed281a05e84b7 Mon Sep 17 00:00:00 2001 From: VGau Date: Mon, 14 Oct 2024 17:21:30 +0200 Subject: [PATCH 2/4] fix: format readme --- sdk/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/sdk/README.md b/sdk/README.md index 5a11cd9cb..702e8fbdc 100644 --- a/sdk/README.md +++ b/sdk/README.md @@ -40,5 +40,3 @@ This package exposes two main classes for usage: ## License This package is licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for more information. - - From f9b3bc08076bafd458a70a39058010470de7eaff Mon Sep 17 00:00:00 2001 From: VGau Date: Mon, 14 Oct 2024 18:07:53 +0200 Subject: [PATCH 3/4] fix: add apt get clean --- sdk/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sdk/Dockerfile b/sdk/Dockerfile index f311ce375..c77e6993b 100644 --- a/sdk/Dockerfile +++ b/sdk/Dockerfile @@ -5,7 +5,10 @@ ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable -RUN apt-get update && apt-get install -y --no-install-recommends python3 ca-certificates bash curl make g++ +RUN apt-get update \ + && apt-get install -y --no-install-recommends python3 ca-certificates bash curl make g++ \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* FROM base AS builder From aacb02fa616f895567d5ab3c0910120360c451d2 Mon Sep 17 00:00:00 2001 From: VGau Date: Mon, 14 Oct 2024 18:36:45 +0200 Subject: [PATCH 4/4] fix: refactor docker cache issue in the CI workflow --- .github/workflows/postman-build-and-publish.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/postman-build-and-publish.yml b/.github/workflows/postman-build-and-publish.yml index 114829d09..081456521 100644 --- a/.github/workflows/postman-build-and-publish.yml +++ b/.github/workflows/postman-build-and-publish.yml @@ -72,7 +72,11 @@ jobs: push: true tags: | ${{ env.IMAGE_NAME }}:${{ env.COMMIT_TAG }}-${{ env.UNTESTED_TAG_SUFFIX }} - cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache - cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max + cache-from: | + type=registry,ref=${{ env.IMAGE_NAME }}:buildcache-amd64,platform=linux/amd64 + type=registry,ref=${{ env.IMAGE_NAME }}:buildcache-arm64,platform=linux/arm64 + cache-to: | + type=registry,ref=${{ env.IMAGE_NAME }}:buildcache-amd64,mode=max,platform=linux/amd64 + type=registry,ref=${{ env.IMAGE_NAME }}:buildcache-arm64,mode=max,platform=linux/arm64 build-args: | NATIVE_LIBS_RELEASE_TAG=blob-libs-v1.0.1