§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