§2024-08-19
This is my Dockerfile to build Rocket.Chat
# Use an official Node.js runtime as the base image
# RocjetChat 6.11.1 requires NodeJs version 14.21.3
FROM node:14.21.3
# 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 && apt-get install -y \
build-essential \
python3 \
python3-pip \
python3-dev \
git \
curl \
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 \
# libjpeg-turbo8-dev \
optipng \
&& rm -rf /var/lib/apt/lists/*
# 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 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:node_14.21.3 (--no-cache) --file ./Dockerfile.6.11.1-01 ./
# sudo docker run -it rocketchat:node_14.21.3 /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
# docker ps
# docker stop (NAMES)
# docker rm (NAMES)11
#
And yarn install error log
fibers@npm:5.0.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-1a1fd628/build.log)
➤ YN0009: │ fibers@npm:5.0.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-625f89a0/build.log)
➤ YN0009: │ optipng-bin@npm:7.0.1 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-e4e8794d/build.log)
/tmp/xfs-1a1fd628/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++`
- /tmp/xfs-625f89a0/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++`
- /tmp/xfs-e4e8794d/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: /app/node_modules/optipng-bin/vendor/optipng: @@8�@@@@@@@�@@@@����: not found
/app/node_modules/optipng-bin/vendor/optipng: 2: /app/node_modules/optipng-bin/vendor/optipng: d: not found
/app/node_modules/optipng-bin/vendor/optipng: 1: /app/node_modules/optipng-bin/vendor/optipng: Syntax error: ";" unexpected
/app/node_modules/optipng-bin/vendor/optipng: 1: /app/node_modules/optipng-bin/vendor/optipng: ELF: not found
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]
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]
(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+0x1e94): 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/e592ac93-af77-4dba-961a-76f2229f1960/src/optipng'
cd ../libpng && \
make -f Makefile PNGLIBCONF_H_PREBUILT=pnglibconf.h.optipng && \
cd ../optipng
make[2]: Entering directory '/tmp/e592ac93-af77-4dba-961a-76f2229f1960/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/e592ac93-af77-4dba-961a-76f2229f1960/src/libpng'
cd ../opngreduc && \
make -f Makefile libopngreduc.a && \
cd ../optipng
make[2]: Entering directory '/tmp/e592ac93-af77-4dba-961a-76f2229f1960/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/e592ac93-af77-4dba-961a-76f2229f1960/src/opngreduc'
cd ../gifread && \
make -f Makefile libgifread.a && \
cd ../optipng
make[2]: Entering directory '/tmp/e592ac93-af77-4dba-961a-76f2229f1960/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/e592ac93-af77-4dba-961a-76f2229f1960/src/gifread'
cd ../pnmio && \
make -f Makefile libpnmio.a && \
cd ../optipng
make[2]: Entering directory '/tmp/e592ac93-af77-4dba-961a-76f2229f1960/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/e592ac93-af77-4dba-961a-76f2229f1960/src/pnmio'
cd ../minitiff && \
make -f Makefile libminitiff.a && \
cd ../optipng
make[2]: Entering directory '/tmp/e592ac93-af77-4dba-961a-76f2229f1960/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/e592ac93-af77-4dba-961a-76f2229f1960/src/minitiff'
cd ../pngxtern && \
make -f Makefile libpngxtern.a && \
cd ../optipng
make[2]: Entering directory '/tmp/e592ac93-af77-4dba-961a-76f2229f1960/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/e592ac93-af77-4dba-961a-76f2229f1960/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/e592ac93-af77-4dba-961a-76f2229f1960/src/optipng'
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 /app/node_modules/optipng-bin/lib/install.js:17:4
How to Fix???