diff --git a/.github/actions/build-docker/action.yml b/.github/actions/build-docker/action.yml index b00709834c389..5100528ac7ae0 100644 --- a/.github/actions/build-docker/action.yml +++ b/.github/actions/build-docker/action.yml @@ -75,7 +75,7 @@ runs: set -o xtrace export DENO_VERSION="${{ inputs.deno-version }}" - # Removes unnecessary swc cores to reduce image sized + # Removes unnecessary swc cores and sharp binaries to reduce image size swc_arch='x64' if [[ "${{ inputs.service }}" == 'rocketchat' ]]; then if [[ "${{ inputs.arch }}" == 'arm64' ]]; then @@ -83,6 +83,14 @@ runs: fi find /tmp/build/bundle/programs/server/npm/node_modules/meteor/babel-compiler/node_modules/@meteorjs/swc-core/.swc/node_modules/@swc -type d -name 'core-*' -not -name "*linux-${swc_arch}-gnu*" -exec rm -rf {} + + + find /tmp/build/bundle/programs/server/npm/node_modules/@img -type d -name 'sharp-*' -not -name "*-linuxmusl-${swc_arch}" -exec rm -rf {} + + + find /tmp/build/bundle/programs/server/npm/node_modules/@napi-rs -type d -name 'pinyin-linux-*' -not -name "*-linux-${swc_arch}-*" -exec rm -rf {} + + + find /tmp/build/bundle/programs/server/npm/node_modules/@esbuild -type d -name 'linux-*' -not -name "*-${swc_arch}" -exec rm -rf {} + + + find /tmp/build/bundle/programs/server/npm/node_modules/@rocket.chat/apps-engine/node_modules/@esbuild -type d -name 'linux-*' -not -name "*-${swc_arch}" -exec rm -rf {} + fi if [[ "${{ inputs.publish-image }}" == 'true' ]]; then diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index 2bee636a47835..faa3f6d7ed17d 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -51,8 +51,8 @@ runs: apps/meteor/ee/server/services/node_modules packages/apps-engine/node_modules packages/apps-engine/.deno-cache - key: node-modules-${{ inputs.type }}-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('package.json') }}-${{ hashFiles('yarn.lock') }}-deno-v${{ inputs.deno-version }}-${{ hashFiles('packages/apps-engine/deno-runtime/deno.lock') }}-v3 - # key: node-modules-${{ inputs.type }}-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('package.json') }}-${{ hashFiles('yarn.lock') }}-deno-v${{ inputs.deno-version }}-${{ hashFiles('packages/apps-engine/deno-runtime/deno.lock') }}-v${{ github.run_id }} + key: node-modules-${{ inputs.type }}-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('package.json') }}-${{ hashFiles('yarn.lock') }}-${{ hashFiles('.yarnrc.yml') }}-deno-v${{ inputs.deno-version }}-${{ hashFiles('packages/apps-engine/deno-runtime/deno.lock') }}-v5 + # key: node-modules-${{ inputs.type }}-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('package.json') }}-${{ hashFiles('yarn.lock') }}-${{ hashFiles('.yarnrc.yml') }}-deno-v${{ inputs.deno-version }}-${{ hashFiles('packages/apps-engine/deno-runtime/deno.lock') }}-v${{ github.run_id }} # # Could use this command to list all paths to save: # find . -name 'node_modules' -prune | grep -v "/\.meteor/" | grep -v "/meteor/packages/" @@ -75,6 +75,12 @@ runs: run: | echo "//registry.npmjs.org/:_authToken=${{ inputs.NPM_TOKEN }}" > ~/.npmrc + - name: yarn config + if: inputs.install + shell: bash + run: | + yarn config set supportedArchitectures --json '{"os": ["linux"], "cpu": ["arm64", "x64"], "libc": ["glibc", "musl"]}' + - name: yarn install if: inputs.install && inputs.type == 'development' shell: bash diff --git a/apps/meteor/.docker/Dockerfile.alpine b/apps/meteor/.docker/Dockerfile.alpine index dbdeb5abc6391..3761e501dcb00 100644 --- a/apps/meteor/.docker/Dockerfile.alpine +++ b/apps/meteor/.docker/Dockerfile.alpine @@ -9,14 +9,7 @@ COPY . /app ENV NODE_ENV=production RUN cd /app/bundle/programs/server \ - && npm install --omit=dev \ - # Re install sharp dependencies to ensure proper binary for architecture - # We only need the @img folder from sharp dependencies - && cd /app/bundle/programs/server/npm/node_modules/sharp \ - && npm install --omit=dev \ - && rm -rf ../@img \ - && mv node_modules/@img ../@img \ - && rm -rf node_modules + && npm install --omit=dev FROM node:22.16.0-alpine3.20