Skip to content

Commit

Permalink
Fix: optimize postman docker build (#183)
Browse files Browse the repository at this point in the history
* fix: optimize postman docker build

* fix: format readme

* fix: add apt get clean

* fix: refactor docker cache issue in the CI workflow
  • Loading branch information
VGau authored Oct 15, 2024
1 parent f9aa7e7 commit bb78efe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/postman-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,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
12 changes: 7 additions & 5 deletions sdk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ 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++ \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

FROM base AS builder

WORKDIR /usr/src/app
Expand All @@ -16,18 +21,15 @@ 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

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

Expand Down
2 changes: 0 additions & 2 deletions sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


0 comments on commit bb78efe

Please sign in to comment.