strapi-community / strapi-tool-dockerize

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

On a fresh install docker-compose up is failing. Something went wrong installing the "sharp" module #36

Closed exotexot closed 1 year ago

exotexot commented 2 years ago

I'm on macOS 12.6 I've got a VM running Ubuntu.

installing latest straps app using npx create-strapi-app. No quick install -- using mysql.

Strapi is running fine locally. But problems start using the dockerize tool.

running yarn build running npx dockerize. running docker-compose up:

`docker-compose up --build Building strapi [+] Building 2.9s (13/13) FINISHED => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 37B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/library/node:16-alpine 0.5s => [internal] load build context 2.3s => => transferring context: 4.58MB 2.2s => [1/8] FROM docker.io/library/node:16-alpine@sha256:88d9d8da697877a4a771a40e5cbc10a12c2ad959e82f3b0f36ef35635e17f693 0.0s => => resolve docker.io/library/node:16-alpine@sha256:88d9d8da697877a4a771a40e5cbc10a12c2ad959e82f3b0f36ef35635e17f693 0.0s => CACHED [2/8] RUN apk update && apk add build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev 0.0s => CACHED [3/8] WORKDIR /opt/ 0.0s => CACHED [4/8] COPY ./package.json ./yarn.lock ./ 0.0s => CACHED [5/8] RUN yarn config set network-timeout 600000 -g && yarn install 0.0s => CACHED [6/8] WORKDIR /opt/app 0.0s => CACHED [7/8] COPY ./ . 0.0s => CACHED [8/8] RUN yarn build 0.0s => exporting to image 0.0s => => exporting layers 0.0s => => writing image sha256:a0239d571785e36e3e7e29d4fb7e66499989e8b06a862b146f951f2301088be4 0.0s => => naming to docker.io/library/strapi:latest 0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them Starting strapiDB ... done Recreating strapi ... done Attaching to strapiDB, strapi strapiDB | 2022-09-28 11:11:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.39-1.el7 started. strapiDB | 2022-09-28 11:11:17+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' strapiDB | 2022-09-28 11:11:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.39-1.el7 started. strapiDB | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock' strapiDB | 2022-09-28T11:11:17.710200Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). strapiDB | 2022-09-28T11:11:17.711503Z 0 [Note] mysqld (mysqld 5.7.39) starting as process 1 ... strapiDB | 2022-09-28T11:11:17.714134Z 0 [Note] InnoDB: PUNCH HOLE support available strapiDB | 2022-09-28T11:11:17.714169Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins strapiDB | 2022-09-28T11:11:17.714177Z 0 [Note] InnoDB: Uses event mutexes strapiDB | 2022-09-28T11:11:17.714180Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier strapiDB | 2022-09-28T11:11:17.714183Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12 strapiDB | 2022-09-28T11:11:17.714185Z 0 [Note] InnoDB: Using Linux native AIO strapiDB | 2022-09-28T11:11:17.714361Z 0 [Note] InnoDB: Number of pools: 1 strapiDB | 2022-09-28T11:11:17.714479Z 0 [Note] InnoDB: Using CPU crc32 instructions strapiDB | 2022-09-28T11:11:17.715711Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M strapiDB | 2022-09-28T11:11:17.721314Z 0 [Note] InnoDB: Completed initialization of buffer pool strapiDB | 2022-09-28T11:11:17.723259Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). strapiDB | 2022-09-28T11:11:17.735731Z 0 [Note] InnoDB: Highest supported file format is Barracuda. strapiDB | 2022-09-28T11:11:17.737457Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 12139546 strapiDB | 2022-09-28T11:11:17.737516Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 12139555 strapiDB | 2022-09-28T11:11:17.737526Z 0 [Note] InnoDB: Database was not shutdown normally! strapiDB | 2022-09-28T11:11:17.737530Z 0 [Note] InnoDB: Starting crash recovery. strapi | yarn run v1.22.19 strapiDB | 2022-09-28T11:11:17.848065Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1" strapiDB | 2022-09-28T11:11:17.848115Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables strapiDB | 2022-09-28T11:11:17.848149Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... strapiDB | 2022-09-28T11:11:17.863636Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. strapiDB | 2022-09-28T11:11:17.864288Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. strapiDB | 2022-09-28T11:11:17.864317Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. strapiDB | 2022-09-28T11:11:17.864789Z 0 [Note] InnoDB: 5.7.39 started; log sequence number 12139555 strapiDB | 2022-09-28T11:11:17.864934Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool strapiDB | 2022-09-28T11:11:17.865121Z 0 [Note] Plugin 'FEDERATED' is disabled. strapiDB | 2022-09-28T11:11:17.867506Z 0 [Note] InnoDB: Buffer pool(s) load completed at 220928 11:11:17 strapiDB | 2022-09-28T11:11:17.869538Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. strapiDB | 2022-09-28T11:11:17.869566Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory. strapiDB | 2022-09-28T11:11:17.869571Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher. strapiDB | 2022-09-28T11:11:17.869573Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher. strapiDB | 2022-09-28T11:11:17.870132Z 0 [Warning] CA certificate ca.pem is self signed. strapiDB | 2022-09-28T11:11:17.870191Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory. strapiDB | 2022-09-28T11:11:17.870419Z 0 [Note] Server hostname (bind-address): '*'; port: 3306 strapiDB | 2022-09-28T11:11:17.870474Z 0 [Note] IPv6 is available. strapiDB | 2022-09-28T11:11:17.870486Z 0 [Note] - '::' resolves to '::'; strapiDB | 2022-09-28T11:11:17.870515Z 0 [Note] Server socket created on IP: '::'. strapiDB | 2022-09-28T11:11:17.872241Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. strapiDB | 2022-09-28T11:11:17.881144Z 0 [Note] Event Scheduler: Loaded 0 events strapiDB | 2022-09-28T11:11:17.881396Z 0 [Note] mysqld: ready for connections. strapiDB | Version: '5.7.39' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL) strapi | $ strapi develop strapi | [2022-09-28 11:11:22.741] debug: ⛔️ Server wasn't able to start properly. strapi | [2022-09-28 11:11:22.743] error: Could not load js config file /opt/app/node_modules/@strapi/plugin-upload/strapi-server.js: strapi | Something went wrong installing the "sharp" module strapi | strapi | Cannot find module '../build/Release/sharp-linuxmusl-x64.node' strapi | Require stack: strapi | - /opt/app/node_modules/sharp/lib/sharp.js strapi | - /opt/app/node_modules/sharp/lib/constructor.js strapi | - /opt/app/node_modules/sharp/lib/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/services/image-manipulation.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/services/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/strapi-server.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/utils/import-default.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/load-config-file.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/config-loader.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/index.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/commands/develop.js strapi | - /opt/app/node_modules/@strapi/strapi/bin/strapi.js strapi | strapi | Possible solutions: strapi | - Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp" strapi | - Install for the current linuxmusl-x64 runtime: "npm install --platform=linuxmusl --arch=x64 sharp" strapi | - Consult the installation documentation: https://sharp.pixelplumbing.com/install strapi | Error: Could not load js config file /opt/app/node_modules/@strapi/plugin-upload/strapi-server.js: strapi | Something went wrong installing the "sharp" module strapi | strapi | Cannot find module '../build/Release/sharp-linuxmusl-x64.node' strapi | Require stack: strapi | - /opt/app/node_modules/sharp/lib/sharp.js strapi | - /opt/app/node_modules/sharp/lib/constructor.js strapi | - /opt/app/node_modules/sharp/lib/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/services/image-manipulation.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/services/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/strapi-server.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/utils/import-default.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/load-config-file.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/config-loader.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/index.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/commands/develop.js strapi | - /opt/app/node_modules/@strapi/strapi/bin/strapi.js strapi | strapi | Possible solutions: strapi | - Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp" strapi | - Install for the current linuxmusl-x64 runtime: "npm install --platform=linuxmusl --arch=x64 sharp" strapi | - Consult the installation documentation: https://sharp.pixelplumbing.com/install strapi | at loadJsFile (/opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/load-config-file.js:20:11) strapi | at loadFile (/opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/load-config-file.js:37:14) strapi | at Object.loadPlugins (/opt/app/node_modules/@strapi/strapi/lib/core/loaders/plugins/index.js:95:26) strapi | at async Strapi.loadPlugins (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:321:5) strapi | at async Promise.all (index 2) strapi | at async Strapi.register (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:357:5) strapi | at async Strapi.load (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:458:5) strapi | at async Strapi.start (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:200:9) strapi | error Command failed with exit code 1. strapi | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

Eventyret commented 2 years ago

Are you by any chance binding node_modules ? As it seems it tries to build a different module then what you are using on your host system

tomastuser commented 1 year ago

Did you manage to find a solution exotexot? I ran into the same issue on Windows 11, with the same shell output as exotexot.

Steps to reproduce:

yarn create strapi-app my-project
cd my-project
npx @strapi-community/dockerize
docker compose up

I looked into the node_modules folder mentioned in the error message (node_modules/sharp/build/Release) in the container looking for the needed sharp-linuxmusl-x64.node file. The contents were these files:

libglib-2.0-0.dll
libgobject-2.0-0.dll
libvips-42.dll
libvips-cpp.dll
sharp-win32-x64.node

Which is the same as the contents of the same folder in my local strapi node_modules.

I checked the Dockerfile and docker-compose.yml files, and from what I can see, they are generated according to the Strapi docs guide.

Dockerfile:

FROM node:16-alpine
# Installing libvips-dev for sharp Compatability
RUN apk update && apk add  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 ./
ENV PATH /opt/node_modules/.bin:$PATH
RUN yarn config set network-timeout 600000 -g && yarn install
WORKDIR /opt/app
COPY ./ .
RUN yarn build
EXPOSE 1337
CMD ["yarn", "develop"]

docker-compose.yml:

version: "3"
services:
  strapi:
    container_name: strapi
    build: .
    image: strapi:latest
    restart: unless-stopped
    env_file: .env
    environment:
      DATABASE_CLIENT: ${DATABASE_CLIENT}
      DATABASE_HOST: strapiDB
      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:
      - strapi
    depends_on:
      - strapiDB

  strapiDB:
    container_name: strapiDB
    platform: linux/amd64 #for platform error on Apple M1 chips
    restart: unless-stopped
    env_file: .env
    image: postgres:12.0-alpine
    environment:
      POSTGRES_USER: ${DATABASE_USERNAME}
      POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
      POSTGRES_DB: ${DATABASE_NAME}
    volumes:
      - strapi-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:
      - strapi

volumes:
  strapi-data:

networks:
  strapi:
    name: Strapi
    driver: bridge

Some posts mentioned it could be a problem with different Node and npm versions, but from what I can see, my versions don't differ that much: My local Node and npm versions: 16.16.0 and 8.11.0 Container Node and npm versions: 16.17.1 and 8.15.0

My Docker Desktop version: 4.12.0, Docker Engine: 20.10.17, Docker Compose 2.10.2

If the node_modules are binding for some reason, is there a way to unbind them?

Eventyret commented 1 year ago

Is node_modules in dockerignore as well?

Eventyret commented 1 year ago

I'm on macOS 12.6 I've got a VM running Ubuntu.

installing latest straps app using npx create-strapi-app. No quick install -- using mysql.

Strapi is running fine locally. But problems start using the dockerize tool.

running yarn build running npx dockerize. running docker-compose up:

`docker-compose up --build Building strapi [+] Building 2.9s (13/13) FINISHED => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 37B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/library/node:16-alpine 0.5s => [internal] load build context 2.3s => => transferring context: 4.58MB 2.2s => [1/8] FROM docker.io/library/node:16-alpine@sha256:88d9d8da697877a4a771a40e5cbc10a12c2ad959e82f3b0f36ef35635e17f693 0.0s => => resolve docker.io/library/node:16-alpine@sha256:88d9d8da697877a4a771a40e5cbc10a12c2ad959e82f3b0f36ef35635e17f693 0.0s => CACHED [2/8] RUN apk update && apk add build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev 0.0s => CACHED [3/8] WORKDIR /opt/ 0.0s => CACHED [4/8] COPY ./package.json ./yarn.lock ./ 0.0s => CACHED [5/8] RUN yarn config set network-timeout 600000 -g && yarn install 0.0s => CACHED [6/8] WORKDIR /opt/app 0.0s => CACHED [7/8] COPY ./ . 0.0s => CACHED [8/8] RUN yarn build 0.0s => exporting to image 0.0s => => exporting layers 0.0s => => writing image sha256:a0239d571785e36e3e7e29d4fb7e66499989e8b06a862b146f951f2301088be4 0.0s => => naming to docker.io/library/strapi:latest 0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them Starting strapiDB ... done Recreating strapi ... done Attaching to strapiDB, strapi strapiDB | 2022-09-28 11:11:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.39-1.el7 started. strapiDB | 2022-09-28 11:11:17+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' strapiDB | 2022-09-28 11:11:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.39-1.el7 started. strapiDB | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock' strapiDB | 2022-09-28T11:11:17.710200Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). strapiDB | 2022-09-28T11:11:17.711503Z 0 [Note] mysqld (mysqld 5.7.39) starting as process 1 ... strapiDB | 2022-09-28T11:11:17.714134Z 0 [Note] InnoDB: PUNCH HOLE support available strapiDB | 2022-09-28T11:11:17.714169Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins strapiDB | 2022-09-28T11:11:17.714177Z 0 [Note] InnoDB: Uses event mutexes strapiDB | 2022-09-28T11:11:17.714180Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier strapiDB | 2022-09-28T11:11:17.714183Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12 strapiDB | 2022-09-28T11:11:17.714185Z 0 [Note] InnoDB: Using Linux native AIO strapiDB | 2022-09-28T11:11:17.714361Z 0 [Note] InnoDB: Number of pools: 1 strapiDB | 2022-09-28T11:11:17.714479Z 0 [Note] InnoDB: Using CPU crc32 instructions strapiDB | 2022-09-28T11:11:17.715711Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M strapiDB | 2022-09-28T11:11:17.721314Z 0 [Note] InnoDB: Completed initialization of buffer pool strapiDB | 2022-09-28T11:11:17.723259Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). strapiDB | 2022-09-28T11:11:17.735731Z 0 [Note] InnoDB: Highest supported file format is Barracuda. strapiDB | 2022-09-28T11:11:17.737457Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 12139546 strapiDB | 2022-09-28T11:11:17.737516Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 12139555 strapiDB | 2022-09-28T11:11:17.737526Z 0 [Note] InnoDB: Database was not shutdown normally! strapiDB | 2022-09-28T11:11:17.737530Z 0 [Note] InnoDB: Starting crash recovery. strapi | yarn run v1.22.19 strapiDB | 2022-09-28T11:11:17.848065Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1" strapiDB | 2022-09-28T11:11:17.848115Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables strapiDB | 2022-09-28T11:11:17.848149Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... strapiDB | 2022-09-28T11:11:17.863636Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. strapiDB | 2022-09-28T11:11:17.864288Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. strapiDB | 2022-09-28T11:11:17.864317Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. strapiDB | 2022-09-28T11:11:17.864789Z 0 [Note] InnoDB: 5.7.39 started; log sequence number 12139555 strapiDB | 2022-09-28T11:11:17.864934Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool strapiDB | 2022-09-28T11:11:17.865121Z 0 [Note] Plugin 'FEDERATED' is disabled. strapiDB | 2022-09-28T11:11:17.867506Z 0 [Note] InnoDB: Buffer pool(s) load completed at 220928 11:11:17 strapiDB | 2022-09-28T11:11:17.869538Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. strapiDB | 2022-09-28T11:11:17.869566Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory. strapiDB | 2022-09-28T11:11:17.869571Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher. strapiDB | 2022-09-28T11:11:17.869573Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher. strapiDB | 2022-09-28T11:11:17.870132Z 0 [Warning] CA certificate ca.pem is self signed. strapiDB | 2022-09-28T11:11:17.870191Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory. strapiDB | 2022-09-28T11:11:17.870419Z 0 [Note] Server hostname (bind-address): '*'; port: 3306 strapiDB | 2022-09-28T11:11:17.870474Z 0 [Note] IPv6 is available. strapiDB | 2022-09-28T11:11:17.870486Z 0 [Note] - '::' resolves to '::'; strapiDB | 2022-09-28T11:11:17.870515Z 0 [Note] Server socket created on IP: '::'. strapiDB | 2022-09-28T11:11:17.872241Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. strapiDB | 2022-09-28T11:11:17.881144Z 0 [Note] Event Scheduler: Loaded 0 events strapiDB | 2022-09-28T11:11:17.881396Z 0 [Note] mysqld: ready for connections. strapiDB | Version: '5.7.39' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL) strapi | $ strapi develop strapi | [2022-09-28 11:11:22.741] debug: ⛔️ Server wasn't able to start properly. strapi | [2022-09-28 11:11:22.743] error: Could not load js config file /opt/app/node_modules/@strapi/plugin-upload/strapi-server.js: strapi | Something went wrong installing the "sharp" module strapi | strapi | Cannot find module '../build/Release/sharp-linuxmusl-x64.node' strapi | Require stack: strapi | - /opt/app/node_modules/sharp/lib/sharp.js strapi | - /opt/app/node_modules/sharp/lib/constructor.js strapi | - /opt/app/node_modules/sharp/lib/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/services/image-manipulation.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/services/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/strapi-server.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/utils/import-default.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/load-config-file.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/config-loader.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/index.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/commands/develop.js strapi | - /opt/app/node_modules/@strapi/strapi/bin/strapi.js strapi | strapi | Possible solutions: strapi | - Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp" strapi | - Install for the current linuxmusl-x64 runtime: "npm install --platform=linuxmusl --arch=x64 sharp" strapi | - Consult the installation documentation: https://sharp.pixelplumbing.com/install strapi | Error: Could not load js config file /opt/app/node_modules/@strapi/plugin-upload/strapi-server.js: strapi | Something went wrong installing the "sharp" module strapi | strapi | Cannot find module '../build/Release/sharp-linuxmusl-x64.node' strapi | Require stack: strapi | - /opt/app/node_modules/sharp/lib/sharp.js strapi | - /opt/app/node_modules/sharp/lib/constructor.js strapi | - /opt/app/node_modules/sharp/lib/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/services/image-manipulation.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/services/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/server/index.js strapi | - /opt/app/node_modules/@strapi/plugin-upload/strapi-server.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/utils/import-default.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/load-config-file.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/config-loader.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/index.js strapi | - /opt/app/node_modules/@strapi/strapi/lib/commands/develop.js strapi | - /opt/app/node_modules/@strapi/strapi/bin/strapi.js strapi | strapi | Possible solutions: strapi | - Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp" strapi | - Install for the current linuxmusl-x64 runtime: "npm install --platform=linuxmusl --arch=x64 sharp" strapi | - Consult the installation documentation: https://sharp.pixelplumbing.com/install strapi | at loadJsFile (/opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/load-config-file.js:20:11) strapi | at loadFile (/opt/app/node_modules/@strapi/strapi/lib/core/app-configuration/load-config-file.js:37:14) strapi | at Object.loadPlugins (/opt/app/node_modules/@strapi/strapi/lib/core/loaders/plugins/index.js:95:26) strapi | at async Strapi.loadPlugins (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:321:5) strapi | at async Promise.all (index 2) strapi | at async Strapi.register (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:357:5) strapi | at async Strapi.load (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:458:5) strapi | at async Strapi.start (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:200:9) strapi | error Command failed with exit code 1. strapi | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

According to the logs your node modules are inside app hence the issue is node_modules part of .dockerignore etc?

tomastuser commented 1 year ago

Adding node_modules to .dockerignore helped, thanks. Would it be possible to mention it in the README? Anyway, thanks!

Eventyret commented 1 year ago

Adding node_modules to .dockerignore helped, thanks. Would it be possible to mention it in the README? Anyway, thanks!

It should be added automatically but will add a warning :)