§20247-08-21

# RocjetChat 6.11.1 requires NodeJs version 14.21.3
FROM ubuntu:20.04
# OS Ubuntu Focal Fossal, 20.04
# npm version is 6.14.18 ?
# yarn version is 3.5.0?

# Set environment variables
ENV MONGO_URL=mongodb://mongo:27017/rocketchat
ENV ROOT_URL=http://localhost:3000
ENV PORT=3000
ENV ACCOUNT_SERVER_URL=http://localhost:3000

# Create and set the working directory
WORKDIR /app

# Install necessary dependencies
RUN apt-get update 
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
RUN apt-get  install -y \
    build-essential \
    curl \
    git \
    autoconf \
    zlib1g-dev \
    zlib1g \
    graphicsmagick \
    libpng-dev
#    zlib1g
#    python3 \
#    python3-pip \
#    python3-dev \
#    g++ \
#    make \
#    autoconf \
#    automake \
#    libtool \
#    pkg-config \
#    libffi-dev \
#    libssl-dev \
#    libgmp-dev \
#    libsqlite3-dev \
#    libzmq3-dev \
#    libncurses5-dev \
#    libncursesw5-dev \
#    libreadline-dev \
#    zlib1g-dev \
#    libbz2-dev \
#    libvips-dev \
#    libpango1.0-dev \
#    libcairo2-dev \
#    libjpeg-dev \
#    libpng-dev \
#    libtiff-dev \
#    libgif-dev

# install node 14.x
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -

## Run `sudo apt-get install -y nodejs` to install Node.js 14.x and npm
## You may also need development tools to build native addons:
#     sudo apt-get install gcc g++ make
RUN apt-get install -y nodejs 
# node is 14.21.3, npm is 6.14.18

## To install the Yarn package manager, run:
#     curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
#     echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
#     sudo apt-get update && sudo apt-get install yarn
RUN   curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null
RUN   echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN   apt-get update && apt-get install yarn
# yarn version is 1.22.22 once , but latter 3.5.0 

# Clone Rocket.Chat repository
RUN git clone https://github.com/RocketChat/Rocket.Chat.git /app

# Set working directory to Rocket.Chat
WORKDIR /app

# Checkout specific version
RUN git checkout 6.11.1

# install meteor, RocketChat 6.11.1 use metero 2.16
# RUN curl https://install.meteor.com/\?release\=2.16 | sh # Failed to work
RUN npm install -g meteor --unsafe-perm # version will be 3.0.2

# Install Rocket.Chat dependencies
# RUB yarn cache clean
# RUN yarn install

# Expose the port Rocket.Chat runs on
EXPOSE 3000

# Define the command to run Rocket.Chat
CMD ["npm", "start"]


#
# Notes
# 
# sudo docker build --tag rocketchat:focal (--no-cache) --file ./Dockerfile.6.11.1.focal ./
# sudo docker run -it rocketchat:focal  /bin/bash
# sudo docker run -d -p 42100:8000 --mount type=bind,source=/volume1/JupyterHub,target=/home/alexlai/JupyterHub --name jupyterhub jupyterhub:archlinux_x86_64_UTF-8 jupyterhub
#                       outside-port:inside-port
# dcoker image prune -a
# docker ps
# docker stop (NAMES)
# docker rm  (NAMES)11
#
# 2024-08-21
# DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
#             Install the buildx component to build images with BuildKit:
#            https://docs.docker.com/go/buildx/
#           https://docs.docker.com/go/buildx/

➤ YN0009: │ mozjpeg@npm:7.1.1 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-53157809/build.log)
➤ YN0009: │ fibers@npm:5.0.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-c607f34b/build.log)
➤ YN0009: │ fibers@npm:5.0.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-5bbc1710/build.log)
➤ YN0009: │ optipng-bin@npm:7.0.1 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-960aa5fd/build.log)
➤ YN0007: │ @rocket.chat/apps-engine@npm:1.44.0 [4d8fd] must be built because it never has been before or the last one failed

Checking for gcc... Using pre-configured libpng... Checking for system zlib... ./configure: error: missing zlib or incorrect zlib version ./configure: note: zlib version 1.2.1 or higher is required



➤ YN0009: │ mozjpeg@npm:7.1.1 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-6d6e2bb5/build.log)
➤ YN0009: │ fibers@npm:5.0.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-ea46fa38/build.log)
➤ YN0009: │ fibers@npm:5.0.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-4da7c961/build.log)
➤ YN0009: │ optipng-bin@npm:7.0.1 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-e7ae3a52/build.log)

root@c92d90791758:/app# yarn install
➤ YN0065: Yarn will periodically gather anonymous telemetry: https://yarnpkg.com/advanced/telemetry
➤ YN0065: Run yarn config set --home enableTelemetry 0 to disable

➤ YN0000: ┌ Project validation
➤ YN0000: │ The current Node version v14.21.3 does not satisfy the required version 14.18.3.
➤ YN0000: └ Completed
➤ YN0000: Failed with errors in 0s 11ms

root@35909f91fd2d:/app# git checkout develop
Previous HEAD position was 12e000d889 Release 6.11.1
Switched to branch 'develop'
Your branch is up to date with 'origin/develop'.
root@35909f91fd2d:/app# git branch
* develop
root@35909f91fd2d:/app# node --version
v14.21.3
root@35909f91fd2d:/app# yarn --version
3.5.0
...

➤ YN0007: │ cwebp-bin@npm:7.0.1 must be built because it never has been before or the last one failed
➤ YN0009: │ mozjpeg@npm:7.1.1 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-89f00a23/build.log)
➤ YN0009: │ fibers@npm:5.0.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-d71b8ff2/build.log)
➤ YN0009: │ fibers@npm:5.0.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-55f1cf2f/build.log)
➤ YN0009: │ optipng-bin@npm:7.0.1 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-bd51ca66/build.log)
➤ YN0007: │ @rocket.chat/apps-engine@npm:1.45.0-alpha.864 [4d8fd] must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 10m 47s
➤ YN0000: Failed with errors in 20m 13s
root@26fe724373b7:/app# cat package.json 
{
        "name": "rocket.chat",
        "version": "6.12.0-develop",
        "description": "Rocket.Chat Monorepo",
        "main": "index.js",
        "private": true,
        "scripts": {
                "build": "turbo run build",
                "build:services": "turbo run build --filter=rocketchat-services...",
                "build:ci": "turbo run build:ci",
                "testunit": "turbo run testunit",
                "dev": "turbo run dev --env-mode=loose --parallel --filter=@rocket.chat/meteor...",
                "dsv": "turbo run dsv --env-mode=loose --filter=@rocket.chat/meteor...",
                "lint": "turbo run lint",
                "storybook": "yarn workspace @rocket.chat/meteor run storybook",
                "fuselage": "./fuselage.sh",
                "fossify": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' ts-node scripts/fossify.ts"
        },
        "devDependencies": {
                "@changesets/cli": "^2.26.2",
                "@types/chart.js": "^2.9.39",
                "@types/js-yaml": "^4.0.8",
                "ts-node": "^10.9.2",
                "turbo": "latest"
        },
        "workspaces": [
                "apps/*",
                "packages/*",
                "ee/apps/*",
                "ee/packages/*",
                "apps/meteor/ee/server/services"
        ],
        "repository": {
                "type": "git",
                "url": "git+https://github.com/RocketChat/Rocket.Chat.git"
        },
        "author": "",
        "license": "MIT",
        "bugs": {
                "url": "https://github.com/RocketChat/Rocket.Chat/issues"
        },
        "homepage": "https://github.com/RocketChat/Rocket.Chat#readme",
        "engines": {
                "yarn": "3.5.0",
                "node": "14.21.3",
                "npm": "Use yarn instead"
        },
        "packageManager": "yarn@3.5.0",
        "houston": {
                "minTag": "0.55.0-rc.0",
                "updateFiles": [
                        "package.json",
                        "apps/meteor/app/utils/rocketchat.info"
                ]
        },
        "volta": {
                "node": "14.21.3",
                "yarn": "1.22.18"
        },
        "resolutions": {
                "minimist": "1.2.6",
                "adm-zip": "0.5.9",
                "preact@10.15.1": "patch:preact@npm:10.15.1#.yarn/patches/preact-npm-10.15.1-bd458de913.patch",
                "@storybook/react-docgen-typescript-plugin@1.0.2-canary.6.9d540b91e815f8fc2f8829189deb00553559ff63.0": "patch:@storybook/react-docgen-typescript-plugin@npm%3A1.0.2-canary.6.9d540b91e815f8fc2f8829189deb00553559ff63.0#./.yarn/patches/@storybook-react-docgen-typescript-plugin-npm-1.0.2-canary.6.9d540b91e815f8fc2f8829189deb00553559ff63.0-b31cc57c40.patch",
                "mongodb@^4.17.1": "patch:mongodb@npm:4.17.1#.yarn/patches/mongodb-npm-4.17.1-a2fe811ff1.patch",
                "@rocket.chat/forked-matrix-sdk-crypto-nodejs": "0.1.0-beta.13",
                "typia@5.3.3": "patch:typia@npm:5.3.3#.yarn/patches/typia-npm-5.3.3-21d3e18463.patch",
                "typia@~5.3.3": "patch:typia@npm%3A5.3.3#./.yarn/patches/typia-npm-5.3.3-21d3e18463.patch"
        },
        "dependencies": {
                "node-gyp": "^9.4.1"
        }
}

§2024-08-23

$ docker run -it rocketchat:focal  /bin/bash
root@8791216baeed:/app# npm install -g node-gyp
root@8791216baeed:/app# node-gyp --version
v10.2.0


➤ YN0007: │ cwebp-bin@npm:7.0.1 must be built because it never has been before or the last one failed
➤ YN0009: │ mozjpeg@npm:7.1.1 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-823b44b5/build.log)
➤ YN0009: │ fibers@npm:5.0.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-16ae44f0/build.log)
➤ YN0009: │ fibers@npm:5.0.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-e9eb5248/build.log)
➤ YN0009: │ optipng-bin@npm:7.0.1 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-9b40d6f2/build.log)
➤ YN0007: │ @rocket.chat/apps-engine@npm:1.44.0 [4d8fd] must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 11m 3s
root@8791216baeed:/app# cat /tmp/xfs-823b44b5/build.log 
# This file contains the result of Yarn building a package (mozjpeg@npm:7.1.1)
# Script name: postinstall

Command failed: /app/node_modules/mozjpeg/vendor/cjpeg -version
/app/node_modules/mozjpeg/vendor/cjpeg: 1: Syntax error: word unexpected (expecting ")")


mozjpeg pre-build test failed
compiling from source
Error: Command failed: /bin/sh -c autoreconf -fiv
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
configure.ac:23: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1


    at /app/node_modules/bin-build/node_modules/execa/index.js:231:11
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Promise.all (index 0)
root@8791216baeed:/app# cat  /tmp/xfs-16ae44f0/build.log
# This file contains the result of Yarn building a package (fibers@npm:5.0.3)
# Script name: install

Usage Error: The nearest package directory (/app/apps/meteor/node_modules/fibers) doesn't seem to be part of the project declared in /app.

- If /app isn't intended to be a project, remove any yarn.lock and/or package.json file there.
- If /app is intended to be a project, it might be that you forgot to list apps/meteor/node_modules/fibers in its workspace configuration.
- Finally, if /app is fine and you intend apps/meteor/node_modules/fibers to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'` 
Alpine users please run: `sudo apk add python make g++`
Usage Error: The nearest package directory (/app/apps/meteor/node_modules/fibers) doesn't seem to be part of the project declared in /app.

- If /app isn't intended to be a project, remove any yarn.lock and/or package.json file there.
- If /app is intended to be a project, it might be that you forgot to list apps/meteor/node_modules/fibers in its workspace configuration.
- Finally, if /app is fine and you intend apps/meteor/node_modules/fibers to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'` 
Alpine users please run: `sudo apk add python make g++`
root@8791216baeed:/app# cat /tmp/xfs-e9eb5248/build.log
# This file contains the result of Yarn building a package (fibers@npm:5.0.3)
# Script name: install

Usage Error: The nearest package directory (/app/apps/meteor/ee/server/services/node_modules/fibers) doesn't seem to be part of the project declared in /app.

- If /app isn't intended to be a project, remove any yarn.lock and/or package.json file there.
- If /app is intended to be a project, it might be that you forgot to list apps/meteor/ee/server/services/node_modules/fibers in its workspace configuration.
- Finally, if /app is fine and you intend apps/meteor/ee/server/services/node_modules/fibers to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'` 
Alpine users please run: `sudo apk add python make g++`
Usage Error: The nearest package directory (/app/apps/meteor/ee/server/services/node_modules/fibers) doesn't seem to be part of the project declared in /app.

- If /app isn't intended to be a project, remove any yarn.lock and/or package.json file there.
- If /app is intended to be a project, it might be that you forgot to list apps/meteor/ee/server/services/node_modules/fibers in its workspace configuration.
- Finally, if /app is fine and you intend apps/meteor/ee/server/services/node_modules/fibers to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'` 
Alpine users please run: `sudo apk add python make g++`
root@8791216baeed:/app# cat /tmp/xfs-9b40d6f2/build.log
# This file contains the result of Yarn building a package (optipng-bin@npm:7.0.1)
# Script name: postinstall

Command failed: /app/node_modules/optipng-bin/vendor/optipng --version
/app/node_modules/optipng-bin/vendor/optipng: 1: @@8�@@@@@@@�@@@@����: not found
/app/node_modules/optipng-bin/vendor/optipng: 2: d: not found
/app/node_modules/optipng-bin/vendor/optipng: 1: ELF: not found
/app/node_modules/optipng-bin/vendor/optipng: 1: Syntax error: ";" unexpected


optipng pre-build test failed
compiling from source
Error: Command failed: /bin/sh -c make install
pngrtran.c:99:1: warning: 'png_rtran_ok' defined but not used [-Wunused-function]
   99 | png_rtran_ok(png_structrp png_ptr, int need_IHDR)
      | ^~~~~~~~~~~~
ar: `u' modifier ignored since `D' is the default (see `U')
ar: `u' modifier ignored since `D' is the default (see `U')
ar: `u' modifier ignored since `D' is the default (see `U')
ar: `u' modifier ignored since `D' is the default (see `U')
pngxmem.c: In function 'pngx_malloc_rows_extended':
pngxmem.c:38:34: warning: comparison is always false due to limited range of data type [-Wtype-limits]
   38 |        (pngx_alloc_size_t)height > (pngx_alloc_size_t)(-1) / sizeof(png_bytep))
      |                                  ^
ar: `u' modifier ignored since `D' is the default (see `U')
/usr/bin/ld: ../libpng/libpng.a(pngrutil.o): in function `png_read_filter_row':
pngrutil.c:(.text+0x1f70): undefined reference to `png_init_filter_functions_neon'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:100: optipng] Error 1
make: *** [Makefile:14: install] Error 2

cd src/optipng && \
make install && \
cd ../..
make[1]: Entering directory '/tmp/d54907e8-50c3-4ab1-a6e4-f7802eeecb3b/src/optipng'
cd ../libpng && \
make -f Makefile PNGLIBCONF_H_PREBUILT=pnglibconf.h.optipng && \
cd ../optipng
make[2]: Entering directory '/tmp/d54907e8-50c3-4ab1-a6e4-f7802eeecb3b/src/libpng'
cp pnglibconf.h.optipng pnglibconf.h
gcc -c -I../zlib  -O2 -Wall -Wextra -o png.o png.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngerror.o pngerror.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngget.o pngget.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngmem.o pngmem.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngpread.o pngpread.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngread.o pngread.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngrio.o pngrio.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngrtran.o pngrtran.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngrutil.o pngrutil.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngset.o pngset.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngtrans.o pngtrans.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngwio.o pngwio.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngwrite.o pngwrite.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngwtran.o pngwtran.c
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngwutil.o pngwutil.c
ar rcs libpng.a png.o pngerror.o pngget.o pngmem.o pngpread.o pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
ranlib libpng.a
gcc -c -I../zlib  -O2 -Wall -Wextra -o pngtest.o pngtest.c
gcc  -L../zlib -o pngtest pngtest.o libpng.a -lz -lm
make[2]: Leaving directory '/tmp/d54907e8-50c3-4ab1-a6e4-f7802eeecb3b/src/libpng'
cd ../opngreduc && \
make -f Makefile libopngreduc.a && \
cd ../optipng
make[2]: Entering directory '/tmp/d54907e8-50c3-4ab1-a6e4-f7802eeecb3b/src/opngreduc'
gcc -c  -O2 -Wall -Wextra  -I../libpng -o opngreduc.o opngreduc.c
ar cru libopngreduc.a opngreduc.o
ranlib libopngreduc.a
make[2]: Leaving directory '/tmp/d54907e8-50c3-4ab1-a6e4-f7802eeecb3b/src/opngreduc'
cd ../gifread && \
make -f Makefile libgifread.a && \
cd ../optipng
make[2]: Entering directory '/tmp/d54907e8-50c3-4ab1-a6e4-f7802eeecb3b/src/gifread'
gcc -c  -O2 -Wall -Wextra -o gifread.o gifread.c
ar cru libgifread.a gifread.o
ranlib libgifread.a
make[2]: Leaving directory '/tmp/d54907e8-50c3-4ab1-a6e4-f7802eeecb3b/src/gifread'
cd ../pnmio && \
make -f Makefile libpnmio.a && \
cd ../optipng
make[2]: Entering directory '/tmp/d54907e8-50c3-4ab1-a6e4-f7802eeecb3b/src/pnmio'
gcc -c  -O2 -Wall -Wextra -o pnmin.o pnmin.c
gcc -c  -O2 -Wall -Wextra -o pnmout.o pnmout.c
gcc -c  -O2 -Wall -Wextra -o pnmutil.o pnmutil.c
ar cru libpnmio.a pnmin.o pnmout.o pnmutil.o
ranlib libpnmio.a
make[2]: Leaving directory '/tmp/d54907e8-50c3-4ab1-a6e4-f7802eeecb3b/src/pnmio'
cd ../minitiff && \
make -f Makefile libminitiff.a && \
cd ../optipng
make[2]: Entering directory '/tmp/d54907e8-50c3-4ab1-a6e4-f7802eeecb3b/src/minitiff'
gcc -c  -O2 -Wall -Wextra -o tiffread.o tiffread.c
gcc -c  -O2 -Wall -Wextra -o tiffutil.o tiffutil.c
ar cru libminitiff.a tiffread.o tiffutil.o 
ranlib libminitiff.a
make[2]: Leaving directory '/tmp/d54907e8-50c3-4ab1-a6e4-f7802eeecb3b/src/minitiff'
cd ../pngxtern && \
make -f Makefile libpngxtern.a && \
cd ../optipng
make[2]: Entering directory '/tmp/d54907e8-50c3-4ab1-a6e4-f7802eeecb3b/src/pngxtern'
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxread.o pngxread.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrbmp.o pngxrbmp.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrgif.o pngxrgif.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrjpg.o pngxrjpg.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrpnm.o pngxrpnm.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrtif.o pngxrtif.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxio.o pngxio.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxmem.o pngxmem.c
gcc -c  -O2 -Wall -Wextra  -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxset.o pngxset.c
ar cru libpngxtern.a pngxread.o pngxrbmp.o pngxrgif.o pngxrjpg.o pngxrpnm.o pngxrtif.o pngxio.o pngxmem.o pngxset.o
ranlib libpngxtern.a
make[2]: Leaving directory '/tmp/d54907e8-50c3-4ab1-a6e4-f7802eeecb3b/src/pngxtern'
gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o optipng.o optipng.c
gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o optim.o optim.c
gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o bitset.o bitset.c
gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o ioutil.o ioutil.c
gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o ratio.o ratio.c
gcc -c  -O2 -Wall -Wextra -I../cexcept  -I../libpng -I../opngreduc -I../pngxtern -o wildargs.o wildargs.c
gcc -s -o optipng optipng.o optim.o bitset.o ioutil.o ratio.o wildargs.o ../opngreduc/libopngreduc.a ../pngxtern/libpngxtern.a ../libpng/libpng.a  ../gifread/libgifread.a ../pnmio/libpnmio.a ../minitiff/libminitiff.a  -lz -lm 
make[1]: Leaving directory '/tmp/d54907e8-50c3-4ab1-a6e4-f7802eeecb3b/src/optipng'

    at /app/node_modules/bin-build/node_modules/execa/index.js:231:11
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async /app/node_modules/optipng-bin/lib/install.js:17:4

ーーーー §2024-08-23 follow https://docs.rocket.chat/docs/deploy-with-ubuntu

root@a5a9025f9ffc:/tmp/bundle/programs/server# npm install --production
npm WARN deprecated node-pre-gyp@0.15.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated npmlog@4.1.2: This package is no longer supported.
npm WARN deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm WARN deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated are-we-there-yet@1.1.7: This package is no longer supported.
npm WARN deprecated gauge@2.7.4: This package is no longer supported.
npm WARN deprecated osenv@0.1.5: This package is no longer supported.
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs

> fibers@5.0.1 install /tmp/bundle/programs/server/node_modules/fibers
> node build.js || nodejs build.js

make: Entering directory '/tmp/bundle/programs/server/node_modules/fibers/build'
  CXX(target) Release/obj.target/fibers/src/fibers.o
../src/fibers.cc: In function 'void uni::SetAccessor(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::String>, uni::FunctionType (*)(v8::Local<v8::String>, const GetterCallbackInfo&), void (*)(v8::Local<v8::String>, v8::Local<v8::Value>, const SetterCallbackInfo&))':
../src/fibers.cc:355:87: warning: cast between incompatible function types from 'uni::FunctionType (*)(v8::Local<v8::String>, const GetterCallbackInfo&)' {aka 'void (*)(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&)'} to 'v8::AccessorNameGetterCallback' {aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&)'} [-Wcast-function-type]
  355 |   object->SetAccessor(isolate->GetCurrentContext(), name, (AccessorNameGetterCallback)getter, (AccessorNameSetterCallback)setter).ToChecked();
      |                                                                                       ^~~~~~
../src/fibers.cc:355:123: warning: cast between incompatible function types from 'void (*)(v8::Local<v8::String>, v8::Local<v8::Value>, const SetterCallbackInfo&)' {aka 'void (*)(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&)'} to 'v8::AccessorNameSetterCallback' {aka 'void (*)(v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&)'} [-Wcast-function-type]
  355 |   object->SetAccessor(isolate->GetCurrentContext(), name, (AccessorNameGetterCallback)getter, (AccessorNameSetterCallback)setter).ToChecked();
      |                                                                                                                           ^~~~~~
In file included from ../src/coroutine.h:1,
                 from ../src/fibers.cc:1:
../src/fibers.cc: At global scope:
/root/.cache/node-gyp/14.21.3/include/node/node.h:793:43: warning: cast between incompatible function types from 'void (*)(v8::Local<v8::Object>)' to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
  793 |       (node::addon_register_func) (regfunc),                          \
      |                                           ^
/root/.cache/node-gyp/14.21.3/include/node/node.h:827:3: note: in expansion of macro 'NODE_MODULE_X'
  827 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
      |   ^~~~~~~~~~~~~
../src/fibers.cc:930:1: note: in expansion of macro 'NODE_MODULE'
  930 | NODE_MODULE(fibers, init)
      | ^~~~~~~~~~~
  CXX(target) Release/obj.target/fibers/src/coroutine.o
  CC(target) Release/obj.target/fibers/src/libcoro/coro.o
  SOLINK_MODULE(target) Release/obj.target/fibers.node
  COPY Release/fibers.node
make: Leaving directory '/tmp/bundle/programs/server/node_modules/fibers/build'
Installed in `/tmp/bundle/programs/server/node_modules/fibers/bin/linux-arm64-83-glibc/fibers.node`
npm WARN lifecycle meteor-dev-bundle@~install: cannot run in wd meteor-dev-bundle@ node npm-rebuild.js (wd=/tmp/bundle/programs/server)
added 144 packages from 75 contributors and audited 156 packages in 32.686s

5 packages are looking for funding
  run `npm fund` for details

found 1 moderate severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
  
root@a5a9025f9ffc:/tmp/bundle/programs/server# mv /tmp/bundle /opt/Rocket.Chat
root@a5a9025f9ffc:/tmp/bundle/programs/server# useradd -M rocketchat && usermod -L rocketchat
root@a5a9025f9ffc:/tmp/bundle/programs/server# chown -R rocketchat:rocketchat /opt/Rocket.Chat
root@a5a9025f9ffc:/tmp/bundle/programs/server# cd /opt/Rocket.Chat/
root@a5a9025f9ffc:/opt/Rocket.Chat# ls
README  main.js  programs  server  star.json
root@a5a9025f9ffc:/opt/Rocket.Chat# node main.js 
root@a5a9025f9ffc:/tmp/bundle/programs/server# mv /tmp/bundle /opt/Rocket.Chat
root@a5a9025f9ffc:/tmp/bundle/programs/server# useradd -M rocketchat && usermod -L rocketchat
root@a5a9025f9ffc:/tmp/bundle/programs/server# chown -R rocketchat:rocketchat /opt/Rocket.Chat
root@a5a9025f9ffc:/tmp/bundle/programs/server# cd /opt/Rocket.Chat/
root@a5a9025f9ffc:/opt/Rocket.Chat# ls
README  main.js  programs  server  star.json
root@a5a9025f9ffc:/opt/Rocket.Chat# node main.js 
/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:218
      throw error;
      ^

MongoServerSelectionError: connect ECONNREFUSED 114.33.29.69:27017
    at Timeout._onTimeout (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/sdam/topology.js:292:38)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7)
 => awaited here:
    at Function.Promise.await (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)
    at new MongoConnection (packages/mongo/mongo_driver.js:216:11)
    at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:9:16)
    at Object.<anonymous> (packages/mongo/remote_collection_driver.js:66:18)
    at Object.defaultRemoteCollectionDriver (packages/underscore.js:812:19)
    at new Collection (packages/mongo/collection.js:124:40)
    at AccountsServer._initializeCollection (packages/accounts-base/accounts_common.js:100:20)
    at new AccountsCommon (packages/accounts-base/accounts_common.js:48:23)
    at new AccountsServer (packages/accounts-base/accounts_server.js:30:5)
    at packages/accounts-base/server_main.js:7:12
    at module (packages/accounts-base/server_main.js:19:31)
    at fileEvaluate (packages/modules-runtime.js:336:7)
    at Module.require (packages/modules-runtime.js:238:14)
    at require (packages/modules-runtime.js:258:21)
    at /opt/Rocket.Chat/programs/server/packages/accounts-base.js:2235:15
    at /opt/Rocket.Chat/programs/server/packages/accounts-base.js:2242:3 {
  reason: TopologyDescription {
    type: 'Unknown',
    servers: Map(1) {
      'mongo:27017' => ServerDescription {
        address: 'mongo:27017',
        type: 'Unknown',
        hosts: [],
        passives: [],
        arbiters: [],
        tags: {},
        minWireVersion: 0,
        maxWireVersion: 0,
        roundTripTime: -1,
        lastUpdateTime: 100871176,
        lastWriteDate: 0,
        error: MongoNetworkError: connect ECONNREFUSED 114.33.29.69:27017
            at connectionFailureError (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connect.js:387:20)
            at Socket.<anonymous> (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connect.js:310:22)
            at Object.onceWrapper (events.js:520:26)
            at Socket.emit (events.js:400:28)
            at emitErrorNT (internal/streams/destroy.js:106:8)
            at emitErrorCloseNT (internal/streams/destroy.js:74:3)
            at processTicksAndRejections (internal/process/task_queues.js:82:21) {
          cause: Error: connect ECONNREFUSED 114.33.29.69:27017
              at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16) {
            errno: -111,
            code: 'ECONNREFUSED',
            syscall: 'connect',
            address: '114.33.29.69',
            port: 27017
          },
          [Symbol(errorLabels)]: Set(1) { 'ResetPool' }
        },
        topologyVersion: null,
        setName: null,
        setVersion: null,
        electionId: null,
        logicalSessionTimeoutMinutes: null,
        primary: null,
        me: null,
        '$clusterTime': null
      }
    },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: null,
    maxElectionId: null,
    maxSetVersion: null,
    commonWireVersion: 0,
    logicalSessionTimeoutMinutes: null
  },
  code: undefined,
  [Symbol(errorLabels)]: Set(0) {}
}