fix: no amd64 binaries on manual installation (#37900)

Co-authored-by: Rodrigo Nascimento <234261+rodrigok@users.noreply.github.com>
pull/37881/head
dionisio-bot[bot] 3 weeks ago committed by GitHub
parent f8154f190e
commit aba62efb22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 10
      .github/actions/build-docker/action.yml
  2. 10
      .github/actions/setup-node/action.yml
  3. 9
      apps/meteor/.docker/Dockerfile.alpine

@ -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

@ -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.os }}-${{ runner.arch }}-${{ 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.os }}-${{ runner.arch }}-${{ 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

@ -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

Loading…
Cancel
Save