Closed martadinata666 closed 2 years ago
Does static build fine for you?
As the dependencies pretty much same, same error occurred. At npm ci --no-audit
in arm64 it need rebuild the optipng-bin
resulting error.
Step 5/10 : RUN npm ci --no-audit
---> Running in 497c13edc2e1
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated @types/browserslist@4.15.0: This is a stub types definition. browserslist provides its own type definitions, so you do not need this installed.
npm WARN deprecated @types/anymatch@3.0.0: This is a stub types definition. anymatch provides its own type definitions, so you do not need this installed.
npm WARN deprecated @stylelint/postcss-markdown@0.36.2: Use the original unforked package instead: postcss-markdown
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm notice
npm notice New minor version of npm available! 8.1.2 -> 8.2.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.2.0>
npm notice Run `npm install -g npm@8.2.0` to update!
npm notice
npm ERR! code 1
npm ERR! path /app/node_modules/optipng-bin
npm ERR! command failed
npm ERR! command sh -c node lib/install.js
npm ERR! compiling from source
npm ERR! spawn Unknown system error -8
npm ERR! optipng pre-build test failed
npm ERR! Error: Command failed: /bin/sh -c make install
npm ERR! pngrtran.c:99:1: warning: 'png_rtran_ok' defined but not used [-Wunused-function]
npm ERR! 99 | png_rtran_ok(png_structrp png_ptr, int need_IHDR)
npm ERR! | ^~~~~~~~~~~~
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! pngxmem.c: In function 'pngx_malloc_rows_extended':
npm ERR! pngxmem.c:38:34: warning: comparison is always false due to limited range of data type [-Wtype-limits]
npm ERR! 38 | (pngx_alloc_size_t)height > (pngx_alloc_size_t)(-1) / sizeof(png_bytep))
npm ERR! | ^
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! /usr/lib/gcc/aarch64-alpine-linux-musl/10.3.1/../../../../aarch64-alpine-linux-musl/bin/ld: ../libpng/libpng.a(pngrutil.o): in function `png_read_filter_row':
npm ERR! pngrutil.c:(.text+0x2330): undefined reference to `png_init_filter_functions_neon'
npm ERR! collect2: error: ld returned 1 exit status
npm ERR! make[1]: *** [Makefile:100: optipng] Error 1
npm ERR! make: *** [Makefile:14: install] Error 2
npm ERR!
npm ERR! cd src/optipng && \
npm ERR! make install && \
npm ERR! cd ../..
npm ERR! make[1]: Entering directory '/tmp/aa675745-da36-4f60-9b8c-52322edbf9ce/src/optipng'
npm ERR! cd ../libpng && \
npm ERR! make -f Makefile PNGLIBCONF_H_PREBUILT=pnglibconf.h.optipng && \
npm ERR! cd ../optipng
npm ERR! make[2]: Entering directory '/tmp/aa675745-da36-4f60-9b8c-52322edbf9ce/src/libpng'
npm ERR! cp pnglibconf.h.optipng pnglibconf.h
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o png.o png.c
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngerror.o pngerror.c
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngget.o pngget.c
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngmem.o pngmem.c
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngpread.o pngpread.c
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngread.o pngread.c
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngrio.o pngrio.c
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngrtran.o pngrtran.c
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngrutil.o pngrutil.c
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngset.o pngset.c
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngtrans.o pngtrans.c
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngwio.o pngwio.c
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngwrite.o pngwrite.c
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngwtran.o pngwtran.c
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngwutil.o pngwutil.c
npm ERR! 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
npm ERR! ranlib libpng.a
npm ERR! gcc -c -I../zlib -O2 -Wall -Wextra -o pngtest.o pngtest.c
npm ERR! gcc -L../zlib -o pngtest pngtest.o libpng.a -lz -lm
npm ERR! make[2]: Leaving directory '/tmp/aa675745-da36-4f60-9b8c-52322edbf9ce/src/libpng'
npm ERR! cd ../opngreduc && \
npm ERR! make -f Makefile libopngreduc.a && \
npm ERR! cd ../optipng
npm ERR! make[2]: Entering directory '/tmp/aa675745-da36-4f60-9b8c-52322edbf9ce/src/opngreduc'
npm ERR! gcc -c -O2 -Wall -Wextra -I../libpng -o opngreduc.o opngreduc.c
npm ERR! ar cru libopngreduc.a opngreduc.o
npm ERR! ranlib libopngreduc.a
npm ERR! make[2]: Leaving directory '/tmp/aa675745-da36-4f60-9b8c-52322edbf9ce/src/opngreduc'
npm ERR! cd ../gifread && \
npm ERR! make -f Makefile libgifread.a && \
npm ERR! cd ../optipng
npm ERR! make[2]: Entering directory '/tmp/aa675745-da36-4f60-9b8c-52322edbf9ce/src/gifread'
npm ERR! gcc -c -O2 -Wall -Wextra -o gifread.o gifread.c
npm ERR! ar cru libgifread.a gifread.o
npm ERR! ranlib libgifread.a
npm ERR! make[2]: Leaving directory '/tmp/aa675745-da36-4f60-9b8c-52322edbf9ce/src/gifread'
npm ERR! cd ../pnmio && \
npm ERR! make -f Makefile libpnmio.a && \
npm ERR! cd ../optipng
npm ERR! make[2]: Entering directory '/tmp/aa675745-da36-4f60-9b8c-52322edbf9ce/src/pnmio'
npm ERR! gcc -c -O2 -Wall -Wextra -o pnmin.o pnmin.c
npm ERR! gcc -c -O2 -Wall -Wextra -o pnmout.o pnmout.c
npm ERR! gcc -c -O2 -Wall -Wextra -o pnmutil.o pnmutil.c
npm ERR! ar cru libpnmio.a pnmin.o pnmout.o pnmutil.o
npm ERR! ranlib libpnmio.a
npm ERR! make[2]: Leaving directory '/tmp/aa675745-da36-4f60-9b8c-52322edbf9ce/src/pnmio'
npm ERR! cd ../minitiff && \
npm ERR! make -f Makefile libminitiff.a && \
npm ERR! cd ../optipng
npm ERR! make[2]: Entering directory '/tmp/aa675745-da36-4f60-9b8c-52322edbf9ce/src/minitiff'
npm ERR! gcc -c -O2 -Wall -Wextra -o tiffread.o tiffread.c
npm ERR! gcc -c -O2 -Wall -Wextra -o tiffutil.o tiffutil.c
npm ERR! ar cru libminitiff.a tiffread.o tiffutil.o
npm ERR! ranlib libminitiff.a
npm ERR! make[2]: Leaving directory '/tmp/aa675745-da36-4f60-9b8c-52322edbf9ce/src/minitiff'
npm ERR! cd ../pngxtern && \
npm ERR! make -f Makefile libpngxtern.a && \
npm ERR! cd ../optipng
npm ERR! make[2]: Entering directory '/tmp/aa675745-da36-4f60-9b8c-52322edbf9ce/src/pngxtern'
npm ERR! gcc -c -O2 -Wall -Wextra -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxread.o pngxread.c
npm ERR! gcc -c -O2 -Wall -Wextra -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrbmp.o pngxrbmp.c
npm ERR! gcc -c -O2 -Wall -Wextra -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrgif.o pngxrgif.c
npm ERR! gcc -c -O2 -Wall -Wextra -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrjpg.o pngxrjpg.c
npm ERR! gcc -c -O2 -Wall -Wextra -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrpnm.o pngxrpnm.c
npm ERR! gcc -c -O2 -Wall -Wextra -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxrtif.o pngxrtif.c
npm ERR! gcc -c -O2 -Wall -Wextra -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxio.o pngxio.c
npm ERR! gcc -c -O2 -Wall -Wextra -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxmem.o pngxmem.c
npm ERR! gcc -c -O2 -Wall -Wextra -I../libpng -I../gifread -I../pnmio -I../minitiff -o pngxset.o pngxset.c
npm ERR! ar cru libpngxtern.a pngxread.o pngxrbmp.o pngxrgif.o pngxrjpg.o pngxrpnm.o pngxrtif.o pngxio.o pngxmem.o pngxset.o
npm ERR! ranlib libpngxtern.a
npm ERR! make[2]: Leaving directory '/tmp/aa675745-da36-4f60-9b8c-52322edbf9ce/src/pngxtern'
npm ERR! gcc -c -O2 -Wall -Wextra -I../cexcept -I../libpng -I../opngreduc -I../pngxtern -o optipng.o optipng.c
npm ERR! gcc -c -O2 -Wall -Wextra -I../cexcept -I../libpng -I../opngreduc -I../pngxtern -o optim.o optim.c
npm ERR! gcc -c -O2 -Wall -Wextra -I../cexcept -I../libpng -I../opngreduc -I../pngxtern -o bitset.o bitset.c
npm ERR! gcc -c -O2 -Wall -Wextra -I../cexcept -I../libpng -I../opngreduc -I../pngxtern -o ioutil.o ioutil.c
npm ERR! gcc -c -O2 -Wall -Wextra -I../cexcept -I../libpng -I../opngreduc -I../pngxtern -o ratio.o ratio.c
npm ERR! gcc -c -O2 -Wall -Wextra -I../cexcept -I../libpng -I../opngreduc -I../pngxtern -o wildargs.o wildargs.c
npm ERR! 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
npm ERR! make[1]: Leaving directory '/tmp/aa675745-da36-4f60-9b8c-52322edbf9ce/src/optipng'
npm ERR!
npm ERR! at /app/node_modules/bin-build/node_modules/execa/index.js:231:11
npm ERR! at runMicrotasks (<anonymous>)
npm ERR! at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm ERR! at async /app/node_modules/optipng-bin/lib/install.js:17:4
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-12-04T10_35_36_148Z-debug.log
The command '/bin/sh -c npm ci --no-audit' returned a non-zero code: 1
I think we're better off removing imagemin and leave it alone, we don't really use it very much and the nuxt plugin for it seems no longer maintained.
After remove imagemin
deps, like linked PR above, the build success SSR type
.
But show some warning when npm run build
WARNING in ./node_modules/node-fetch/lib/index.js
Module not found: Error: Can't resolve 'encoding' in '/app/node_modules/node-fetch/lib'
@ ./node_modules/node-fetch/lib/index.js
@ ./src/.nuxt/server.js
@ multi ./node_modules/@nuxt/components/lib/installComponents.js ./src/.nuxt/server.js
And command npm run start:ssr
seems missing when i check the package.json
inside builded image
/app # cat package.json
{
"name": "jellyfin-vue",
"author": "Jellyfin Team",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "nuxt-start"
},
"dependencies": {
"nuxt-start": "^2.15.8"
}
}
/app # cat nuxt.config.js
const config = {
server: {
port: 80,
host: '0.0.0.0'
},
telemetry: false
};
Seems package.json not copied correcly? 🤔
The static
build is ok, as it using nginx to server static files.
SSR has a different package and lockfile files as it's using only the runtime dependencies, so the docker container is not cluttered with development dependencies that are not needed at all for the end user.
Imagemin is a development dependency.
@martadinata666 Can you verify this is fixed by #1615?
Which is in master :)
After few builds this is the dockerfile that work.
Dockerfile.ssr
## This dockerfile builds the client entirely in a Docker context
FROM node:16-alpine AS build
# This needed to recompile the deasync deps
RUN apk add --no-cache python3 make g++
WORKDIR /app
COPY . .
# Install dependencies
RUN npm -d ci --no-audit
# Build SSR app for production in standalone mode
RUN npm -d run build:ssr:standalone
# Build final image
FROM node:16-alpine
WORKDIR /app
COPY .docker/package.json .docker/package-lock.json .docker/nuxt.config.js ./
# Copy client files from the build image
COPY --from=build /app/src/.nuxt ./.nuxt
COPY --from=build /app/src/static ./static
# Install runtime dependencies
RUN npm -d ci --production --no-audit
RUN rm -rf package-lock.json
EXPOSE 80
CMD [ "npx", "nuxt-start" ]
So exactly the same as the one in master but without the debug output from npm.
Thank you very much for your troubleshooting. Closing this then!
In master missing this part.
# This needed to recompile the deasync deps
RUN apk add --no-cache python3 make g++
Need to add to both Dockerfile.ssr
and Dockerfile
Interesting, those aren't needed on the x86_64 version of alpine image. So either they are bundled in it, or the deasync dep doesn't have to be built on x86_64.
in my exp building nodejs apps with arm64, few node_modules doesn't get built for arm64, so it need rebuild from source.
The two dockerfiles in master now have the needed packages. Feel free to tell us if it works or not :)
Confirmed working beatifully 👍🏼
Build fail nuxt not found check the Dockerfile
# Build client
RUN npm run build
So it expected nuxt
to be available or exist before hannd, as the Dockerfile used to be
# Install dependencies
RUN npm ci --no-audit && \
npm run build
Seems accidentally removed on #1685 ? Cant really tell, checking seems it not removed but the install deps part missing. 🤔
Doesn't seem like this commit is the culprit to me. Maybe you could do a cherry-pick to pinpoint the faulty commit? :)
Oh sorry my fault, npm ci
, it moved before
# Set commit hash RUN if [[ $IS_STABLE == "0" ]] ; then NUXT_ENV_COMMIT=$(git rev-parse HEAD) ; fi
then i thought it missing. 🤦🏼
Np. Most importantly, does it work for you?
Description of the bug
Error installing node deps
opting-bin
Steps to reproduce
docker build -t jellyfin-vue:local -f Dockerfile.ssr .
Expected behavior
Complete build
Logs
No response
Screenshots
No response
Platform
Linux
Browser
Other (Please specify in the "additional context" section)
Jellyfin server version
git master
Additional context