strapi-community / strapi-tool-dockerize

Easy add support for docker to your strapi project
MIT License
543 stars 35 forks source link

docker build fail when install sharp #99

Closed ausir0726 closed 6 months ago

ausir0726 commented 11 months ago

🐛 Bug Report

seems like have some issue with libvips when install sharp.

🤷‍♀️ What did you do

execute docker compose up --build

⛔️ Error log

$ docker compose up --build
time="2023-10-23T16:14:42+08:00" level=warning msg="The \"op\" variable is not set. Defaulting to a blank string."
time="2023-10-23T16:14:42+08:00" level=warning msg="The \"op\" variable is not set. Defaulting to a blank string."
time="2023-10-23T16:14:42+08:00" level=warning msg="The \"op\" variable is not set. Defaulting to a blank string."
time="2023-10-23T16:14:42+08:00" level=warning msg="The \"op\" variable is not set. Defaulting to a blank string."
time="2023-10-23T16:14:42+08:00" level=warning msg="The \"op\" variable is not set. Defaulting to a blank string."
[+] Building 102.6s (10/14)                                                                                                                                         docker:default
 => [weitech internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 99B                                                                                                                                              0.0s
 => [weitech internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 641B                                                                                                                                          0.0s
 => [weitech internal] load metadata for docker.io/library/node:18-alpine                                                                                                     1.9s
 => [weitech auth] library/node:pull token for registry-1.docker.io                                                                                                           0.0s
 => CACHED [weitech 1/9] FROM docker.io/library/node:18-alpine@sha256:435dcad253bb5b7f347ebc69c8cc52de7c912eb7241098b920f2fc2d7843183d                                        0.0s
 => [weitech internal] load build context                                                                                                                                     0.1s
 => => transferring context: 5.34kB                                                                                                                                           0.0s
 => [weitech 2/9] RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev                                               24.1s
 => [weitech 3/9] WORKDIR /opt/                                                                                                                                               0.1s
 => [weitech 4/9] COPY package.json yarn.lock ./                                                                                                                              0.1s
 => ERROR [weitech 5/9] RUN yarn config set network-timeout 600000 -g && yarn install                                                                                        76.0s
------
 > [weitech 5/9] RUN yarn config set network-timeout 600000 -g && yarn install:
0.915 yarn config v1.22.19
0.958 success Set "network-timeout" to "600000".
0.958 Done in 0.05s.
1.200 yarn install v1.22.19
1.291 [1/5] Validating package.json...
1.295 [2/5] Resolving packages...
1.762 [3/5] Fetching packages...
52.69 [4/5] Linking dependencies...
52.69 warning " > @strapi/plugin-i18n@4.14.5" has unmet peer dependency "react@^17.0.0 || ^18.0.0".
52.69 warning " > @strapi/plugin-i18n@4.14.5" has unmet peer dependency "react-dom@^17.0.0 || ^18.0.0".
52.69 warning " > @strapi/plugin-i18n@4.14.5" has unmet peer dependency "react-router-dom@5.3.4".
52.69 warning " > @strapi/plugin-i18n@4.14.5" has unmet peer dependency "styled-components@5.3.3".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system@1.12.2" has unmet peer dependency "react@^17.0.0 || ^18.0.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system@1.12.2" has unmet peer dependency "react-dom@^17.0.0 || ^18.0.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system@1.12.2" has unmet peer dependency "react-router-dom@^5.2.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system@1.12.2" has unmet peer dependency "styled-components@^5.2.1".
52.69 warning "@strapi/plugin-i18n > @strapi/helper-plugin@4.14.5" has unmet peer dependency "react@^17.0.0 || ^18.0.0".
52.69 warning "@strapi/plugin-i18n > @strapi/helper-plugin@4.14.5" has unmet peer dependency "react-dom@^17.0.0 || ^18.0.0".
52.69 warning "@strapi/plugin-i18n > @strapi/helper-plugin@4.14.5" has unmet peer dependency "react-router-dom@^5.3.4".
52.69 warning "@strapi/plugin-i18n > @strapi/helper-plugin@4.14.5" has unmet peer dependency "styled-components@^5.3.3".
52.69 warning "@strapi/plugin-i18n > @strapi/icons@1.12.2" has unmet peer dependency "react@^17.0.0 || ^18.0.0".
52.69 warning "@strapi/plugin-i18n > @strapi/icons@1.12.2" has unmet peer dependency "react-dom@^17.0.0 || ^18.0.0".
52.69 warning "@strapi/plugin-i18n > formik@2.4.0" has unmet peer dependency "react@>=16.8.0".
52.69 warning "@strapi/plugin-i18n > react-intl@6.4.1" has unmet peer dependency "react@^16.6.0 || 17 || 18".
52.69 warning "@strapi/plugin-i18n > react-query@3.39.3" has unmet peer dependency "react@^16.8.0 || ^17.0.0 || ^18.0.0".
52.69 warning "@strapi/plugin-i18n > react-redux@8.1.1" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @floating-ui/react-dom@2.0.2" has unmet peer dependency "react@>=16.8.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @floating-ui/react-dom@2.0.2" has unmet peer dependency "react-dom@>=16.8.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dismissable-layer@1.0.5" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dismissable-layer@1.0.5" has unmet peer dependency "react-dom@^16.8 || ^17.0 || ^18.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dropdown-menu@2.0.6" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dropdown-menu@2.0.6" has unmet peer dependency "react-dom@^16.8 || ^17.0 || ^18.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-focus-scope@1.0.4" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-focus-scope@1.0.4" has unmet peer dependency "react-dom@^16.8 || ^17.0 || ^18.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives@1.12.2" has unmet peer dependency "react@^17.0.0 || ^18.0.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives@1.12.2" has unmet peer dependency "react-dom@^17.0.0 || ^18.0.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @uiw/react-codemirror@4.21.20" has unmet peer dependency "@babel/runtime@>=7.11.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @uiw/react-codemirror@4.21.20" has unmet peer dependency "@codemirror/state@>=6.0.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @uiw/react-codemirror@4.21.20" has unmet peer dependency "@codemirror/theme-one-dark@>=6.0.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @uiw/react-codemirror@4.21.20" has unmet peer dependency "@codemirror/view@>=6.0.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @uiw/react-codemirror@4.21.20" has unmet peer dependency "codemirror@>=6.0.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @uiw/react-codemirror@4.21.20" has unmet peer dependency "react@>=16.8.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > @uiw/react-codemirror@4.21.20" has unmet peer dependency "react-dom@>=16.8.0".
52.69 warning "@strapi/plugin-i18n > @strapi/design-system > react-remove-scroll@2.5.7" has unmet peer dependency "react@^16.8.0 || ^17.0.0 || ^18.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/helper-plugin > react-helmet@6.1.0" has unmet peer dependency "react@>=16.3.0".
52.70 warning "@strapi/plugin-i18n > @strapi/helper-plugin > react-select@5.7.0" has unmet peer dependency "react@^16.8.0 || ^17.0.0 || ^18.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/helper-plugin > react-select@5.7.0" has unmet peer dependency "react-dom@^16.8.0 || ^17.0.0 || ^18.0.0".
52.70 warning "@strapi/plugin-i18n > react-redux > use-sync-external-store@1.2.0" has unmet peer dependency "react@^16.8.0 || ^17.0.0 || ^18.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dismissable-layer > @radix-ui/react-compose-refs@1.0.1" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dismissable-layer > @radix-ui/react-primitive@1.0.3" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dismissable-layer > @radix-ui/react-primitive@1.0.3" has unmet peer dependency "react-dom@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dismissable-layer > @radix-ui/react-use-callback-ref@1.0.1" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dismissable-layer > @radix-ui/react-use-escape-keydown@1.0.3" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dropdown-menu > @radix-ui/react-context@1.0.1" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dropdown-menu > @radix-ui/react-id@1.0.1" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dropdown-menu > @radix-ui/react-menu@2.0.6" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dropdown-menu > @radix-ui/react-menu@2.0.6" has unmet peer dependency "react-dom@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dropdown-menu > @radix-ui/react-use-controllable-state@1.0.1" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-collection@1.0.3" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-collection@1.0.3" has unmet peer dependency "react-dom@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-direction@1.0.1" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-focus-guards@1.0.1" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-popper@1.1.3" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-popper@1.1.3" has unmet peer dependency "react-dom@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-portal@1.0.4" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-portal@1.0.4" has unmet peer dependency "react-dom@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-slot@1.0.2" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-use-layout-effect@1.0.1" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-use-previous@1.0.1" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-visually-hidden@1.0.3" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-visually-hidden@1.0.3" has unmet peer dependency "react-dom@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.21.20" has unmet peer dependency "@codemirror/autocomplete@>=6.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.21.20" has unmet peer dependency "@codemirror/language@>=6.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.21.20" has unmet peer dependency "@codemirror/lint@>=6.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.21.20" has unmet peer dependency "@codemirror/search@>=6.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.21.20" has unmet peer dependency "@codemirror/view@>=6.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > react-remove-scroll > react-remove-scroll-bar@2.3.4" has unmet peer dependency "react@^16.8.0 || ^17.0.0 || ^18.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > react-remove-scroll > react-style-singleton@2.2.1" has unmet peer dependency "react@^16.8.0 || ^17.0.0 || ^18.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > react-remove-scroll > use-callback-ref@1.3.0" has unmet peer dependency "react@^16.8.0 || ^17.0.0 || ^18.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > react-remove-scroll > use-sidecar@1.1.2" has unmet peer dependency "react@^16.8.0 || ^17.0.0 || ^18.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/helper-plugin > react-helmet > react-side-effect@2.1.2" has unmet peer dependency "react@^16.3.0 || ^17.0.0 || ^18.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/helper-plugin > react-select > @emotion/react@11.11.1" has unmet peer dependency "react@>=16.8.0".
52.70 warning "@strapi/plugin-i18n > @strapi/helper-plugin > react-select > react-transition-group@4.4.5" has unmet peer dependency "react@>=16.6.0".
52.70 warning "@strapi/plugin-i18n > @strapi/helper-plugin > react-select > react-transition-group@4.4.5" has unmet peer dependency "react-dom@>=16.6.0".
52.70 warning "@strapi/plugin-i18n > @strapi/helper-plugin > react-select > use-isomorphic-layout-effect@1.1.2" has unmet peer dependency "react@^16.8.0 || ^17.0.0 || ^18.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dropdown-menu > @radix-ui/react-menu > @radix-ui/react-presence@1.0.1" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dropdown-menu > @radix-ui/react-menu > @radix-ui/react-presence@1.0.1" has unmet peer dependency "react-dom@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @radix-ui/react-dropdown-menu > @radix-ui/react-menu > react-remove-scroll@2.5.5" has unmet peer dependency "react@^16.8.0 || ^17.0.0 || ^18.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-popper > @radix-ui/react-arrow@1.0.3" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-popper > @radix-ui/react-arrow@1.0.3" has unmet peer dependency "react-dom@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-popper > @radix-ui/react-use-rect@1.0.1" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @strapi/ui-primitives > @radix-ui/react-popper > @radix-ui/react-use-size@1.0.1" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
52.70 warning "@strapi/plugin-i18n > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup > @codemirror/autocomplete@6.10.2" has unmet peer dependency "@lezer/common@^1.0.0".
52.70 warning "@strapi/plugin-i18n > @strapi/helper-plugin > react-select > @emotion/react > @emotion/use-insertion-effect-with-fallbacks@1.0.1" has unmet peer dependency "react@>=16.8.0".
52.70 warning " > @strapi/plugin-users-permissions@4.14.5" has unmet peer dependency "react@^17.0.0 || ^18.0.0".
52.70 warning " > @strapi/plugin-users-permissions@4.14.5" has unmet peer dependency "react-dom@^17.0.0 || ^18.0.0".
52.70 warning " > @strapi/plugin-users-permissions@4.14.5" has unmet peer dependency "react-router-dom@5.3.4".
52.70 warning " > @strapi/plugin-users-permissions@4.14.5" has unmet peer dependency "styled-components@5.3.3".
52.71 warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.14.5" has unmet peer dependency "react@^17.0.0 || ^18.0.0".
52.71 warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.14.5" has unmet peer dependency "react-dom@^17.0.0 || ^18.0.0".
52.71 warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.14.5" has unmet peer dependency "react-router-dom@5.3.4".
52.71 warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.14.5" has unmet peer dependency "styled-components@5.3.3".
52.71 warning "@strapi/strapi > @strapi/plugin-email@4.14.5" has unmet peer dependency "react@^17.0.0 || ^18.0.0".
52.71 warning "@strapi/strapi > @strapi/plugin-email@4.14.5" has unmet peer dependency "react-dom@^17.0.0 || ^18.0.0".
52.71 warning "@strapi/strapi > @strapi/plugin-email@4.14.5" has unmet peer dependency "react-router-dom@5.3.4".
52.71 warning "@strapi/strapi > @strapi/plugin-email@4.14.5" has unmet peer dependency "styled-components@5.3.3".
52.71 warning "@strapi/strapi > @strapi/plugin-upload@4.14.5" has unmet peer dependency "react@^17.0.0 || ^18.0.0".
52.71 warning "@strapi/strapi > @strapi/plugin-upload@4.14.5" has unmet peer dependency "react-dom@^17.0.0 || ^18.0.0".
52.71 warning "@strapi/strapi > @strapi/plugin-upload@4.14.5" has unmet peer dependency "react-router-dom@5.3.4".
52.71 warning "@strapi/strapi > @strapi/plugin-upload@4.14.5" has unmet peer dependency "styled-components@5.3.3".
52.71 warning "@strapi/strapi > @strapi/admin > styled-components > babel-plugin-styled-components > @babel/plugin-syntax-jsx@7.22.5" has unmet peer dependency "@babel/core@^7.0.0-0".
71.63 [5/5] Building fresh packages...
72.61 error /opt/node_modules/sharp: Command failed.
72.61 Exit code: 127
72.61 Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
72.61 Arguments:
72.61 Directory: /opt/node_modules/sharp
72.61 Output:
72.61 sharp: Detected globally-installed libvips v8.14.3
72.61 sharp: Building from source via node-gyp
72.61 /bin/sh: node-gyp: not found
72.61 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
failed to solve: process "/bin/sh -c yarn config set network-timeout 600000 -g && yarn install" did not complete successfully: exit code: 127

🙇‍♀️ Expected behavior/code

A clear and concise description of what you expected to happen (or code).

👩‍💻 Environment

💡 Possible Solution

remove vips-dev on Dockfile and Dockerfile.prod

RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev
Eventyret commented 11 months ago

Libvips should be installed for sharp to work. Are you using a docker-compose file and bind mounting node_modules etc, if you have a docker-compose file can you share it please.

ausir0726 commented 11 months ago

here is my docker-compose file and dockerfile when I remove install vips-dev , it's work fine.

docker-compse.yml

version: '3'
services:
  weitech:
    container_name: weitech
    build:
      context: .
      dockerfile: Dockerfile
    image: weitech:latest
    restart: unless-stopped
    env_file: .env
    environment:
      DATABASE_CLIENT: ${DATABASE_CLIENT}
      DATABASE_HOST: weitechDB
      DATABASE_NAME: ${DATABASE_NAME}
      DATABASE_USERNAME: ${DATABASE_USERNAME}
      DATABASE_PORT: ${DATABASE_PORT}
      JWT_SECRET: ${JWT_SECRET}
      ADMIN_JWT_SECRET: ${ADMIN_JWT_SECRET}
      DATABASE_PASSWORD: ${DATABASE_PASSWORD}
      NODE_ENV: ${NODE_ENV}
    volumes:
      - ./config:/opt/app/config
      - ./src:/opt/app/src
      - ./package.json:/opt/package.json
      - ./yarn.lock:/opt/yarn.lock

      - ./.env:/opt/app/.env
      - ./public/uploads:/opt/app/public/uploads
    ports:
      - '1337:1337'
    networks:
      - weitech
    depends_on:
      - weitechDB

  weitechDB:
    container_name: weitechDB
    platform: linux/amd64 #for platform error on Apple M1 chips
    restart: unless-stopped
    env_file: .env
    image: postgres:14.5-alpine
    environment:
      POSTGRES_USER: ${DATABASE_USERNAME}
      POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
      POSTGRES_DB: ${DATABASE_NAME}
    volumes:
      - weitech-data:/var/lib/postgresql/data/ #using a volume
      #- ./data:/var/lib/postgresql/data/ # if you want to use a bind folder

    ports:
      - '5432:5432'
    networks:
      - weitech

  weitechAdminer:
    container_name: weitechAdminer
    image: adminer
    restart: unless-stopped
    ports:
      - '9090:8080'
    environment:
      - ADMINER_DEFAULT_SERVER=weitechDB
    networks:
      - weitech
    depends_on:
      - weitechDB

volumes:
  weitech-data:

networks:
  weitech:
    name: Weitech
    driver: bridge

Dockerfile

FROM node:18-alpine
# Installing libvips-dev for sharp Compatibility
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}

WORKDIR /opt/
COPY package.json yarn.lock ./
RUN yarn config set network-timeout 600000 -g && yarn install

WORKDIR /opt/app
COPY . .
ENV PATH /opt/node_modules/.bin:$PATH
RUN chown -R node:node /opt/app
USER node
RUN ["yarn", "build"]
EXPOSE 1337
CMD ["yarn", "develop"]
jacosro commented 11 months ago

Same issue here. Dockerfile and docker-compose are generated by the tool. Removing vips-dev from apk add line solves the problem. Is this needed?

tennox commented 8 months ago

My build also fails since a few weeks (on the same commit which worked earlier) with sharp-related issue:

#14 54.35 [5/5] Building fresh packages...
#14 67.67 error /opt/node_modules/sharp: Command failed.
#14 67.67 Exit code: 1
#14 67.67 Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
#14 67.67 Arguments: 
#14 67.67 Directory: /opt/node_modules/sharp
#14 67.67 Output:
#14 67.67 sharp: Detected globally-installed libvips v8.15.0
#14 67.67 sharp: Building from source via node-gyp
#14 67.67 gyp info it worked if it ends with ok
#14 67.67 gyp info using node-gyp@10.0.1
#14 67.67 gyp info using node@18.19.0 | linux | x64
#14 67.67 gyp info find Python using Python version 3.11.6 found at "/usr/bin/python3"
#14 67.67 
#14 67.67 gyp http GET https://unofficial-builds.nodejs.org/download/release/v18.19.0/node-v18.19.0-headers.tar.gz
#14 67.67 gyp http 200 https://unofficial-builds.nodejs.org/download/release/v18.19.0/node-v18.19.0-headers.tar.gz
#14 67.67 gyp http GET https://unofficial-builds.nodejs.org/download/release/v18.19.0/SHASUMS256.txt
#14 67.67 gyp http 200 https://unofficial-builds.nodejs.org/download/release/v18.19.0/SHASUMS256.txt
#14 67.67 gyp info spawn /usr/bin/python3
#14 67.67 gyp info spawn args [
#14 67.67 gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
#14 67.67 gyp info spawn args 'binding.gyp',
#14 67.67 gyp info spawn args '-f',
#14 67.67 gyp info spawn args 'make',
#14 67.67 gyp info spawn args '-I',
#14 67.67 gyp info spawn args '/opt/node_modules/sharp/build/config.gypi',
#14 67.67 gyp info spawn args '-I',
#14 67.67 gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
#14 67.67 gyp info spawn args '-I',
#14 67.67 gyp info spawn args '/root/.cache/node-gyp/18.19.0/include/node/common.gypi',
#14 67.67 gyp info spawn args '-Dlibrary=shared_library',
#14 67.67 gyp info spawn args '-Dvisibility=default',
#14 67.67 gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/18.19.0',
#14 67.67 gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
#14 67.67 gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/18.19.0/<(target_arch)/node.lib',
#14 67.67 gyp info spawn args '-Dmodule_root_dir=/opt/node_modules/sharp',
#14 67.67 gyp info spawn args '-Dnode_engine=v8',
#14 67.67 gyp info spawn args '--depth=.',
#14 67.67 gyp info spawn args '--no-parallel',
#14 67.67 gyp info spawn args '--generator-output',
#14 67.67 gyp info spawn args 'build',
#14 67.67 gyp info spawn args '-Goutput_dir=.'
#14 67.67 gyp info spawn args ]
#14 67.67 gyp info spawn make
#14 67.67 gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
#14 67.67 make: Entering directory '/opt/node_modules/sharp/build'
#14 67.67   CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
#14 67.67 rm -f Release/obj.target/../node-addon-api/nothing.a Release/obj.target/../node-addon-api/nothing.a.ar-file-list; mkdir -p `dirname Release/obj.target/../node-addon-api/nothing.a`
#14 67.67 ar crs Release/obj.target/../node-addon-api/nothing.a @Release/obj.target/../node-addon-api/nothing.a.ar-file-list
#14 67.67   COPY Release/nothing.a
#14 67.67   TOUCH Release/obj.target/libvips-cpp.stamp
#14 67.67   CXX(target) Release/obj.target/sharp-linuxmusl-x64/src/common.o
#14 67.67   CXX(target) Release/obj.target/sharp-linuxmusl-x64/src/metadata.o
#14 67.67   CXX(target) Release/obj.target/sharp-linuxmusl-x64/src/stats.o
#14 67.67   CXX(target) Release/obj.target/sharp-linuxmusl-x64/src/operations.o
#14 67.67   CXX(target) Release/obj.target/sharp-linuxmusl-x64/src/pipeline.o
#14 67.67 ../src/pipeline.cc: In member function 'virtual void PipelineWorker::OnOK()':
#14 67.67 ../src/pipeline.cc:1230:30: error: aggregate 'PipelineWorker::OnOK()::stat64 st' has incomplete type and cannot be defined
#14 67.67  1230 |         struct STAT64_STRUCT st;
#14 67.67       |                              ^~
#14 67.67 ../src/pipeline.cc:1231:55: error: invalid use of incomplete type 'struct PipelineWorker::OnOK()::stat64'
#14 67.67  1231 |         if (STAT64_FUNCTION(baton->fileOut.data(), &st) == 0) {
#14 67.67       |                                                       ^
#14 67.67 ../src/pipeline.cc:33:23: note: forward declaration of 'struct PipelineWorker::OnOK()::stat64'
#14 67.67    33 | #define STAT64_STRUCT stat64
#14 67.67       |                       ^~~~~~
#14 67.67 ../src/pipeline.cc:1230:16: note: in expansion of macro 'STAT64_STRUCT'
#14 67.67  1230 |         struct STAT64_STRUCT st;
#14 67.67       |                ^~~~~~~~~~~~~
#14 67.67 make: *** [sharp-linuxmusl-x64.target.mk:167: Release/obj.target/sharp-linuxmusl-x64/src/pipeline.o] Error 1
#14 67.67 make: Leaving directory '/opt/node_modules/sharp/build'
#14 67.67 gyp ERR! build error 
#14 67.67 gyp ERR! stack Error: `make` failed with exit code: 2
#14 67.67 gyp ERR! stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
#14 67.67 gyp ERR! System Linux 5.4.109+
#14 67.67 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
#14 67.67 gyp ERR! cwd /opt/node_modules/sharp
#14 67.67 gyp ERR! node -v v18.19.0
#14 67.67 gyp ERR! node-gyp -v v10.0.1
#14 67.67 gyp ERR! not ok
#14 67.68 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
#14 ERROR: process "/bin/sh -c yarn config set network-timeout 600000 -g && yarn install --production" did not complete successfully: exit code: 1
------
 > [build 5/8] RUN yarn config set network-timeout 600000 -g && yarn install --production:
67.67 gyp ERR! build error 
67.67 gyp ERR! stack Error: `make` failed with exit code: 2
67.67 gyp ERR! stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
67.67 gyp ERR! System Linux 5.4.109+
67.67 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
67.67 gyp ERR! cwd /opt/node_modules/sharp
67.67 gyp ERR! node -v v18.19.0
67.67 gyp ERR! node-gyp -v v10.0.1
67.67 gyp ERR! not ok
67.68 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
Dockerfile.prod:9
--------------------
   7 |     WORKDIR /opt/
   8 |     COPY package.json yarn.lock ./
   9 | >>> RUN yarn config set network-timeout 600000 -g && yarn install --production
  10 |     ENV PATH /opt/node_modules/.bin:$PATH
  11 |     WORKDIR /opt/app
--------------------
error: failed to solve: process "/bin/sh -c yarn config set network-timeout 600000 -g && yarn install --production" did not complete successfully: exit code: 1
tennox commented 8 months ago

Fixed it - I think by updating npm dependencies (i.e. strapi)