通过 Docker 问题快速安装 Sharp
Express Sharp install via Docker issue
我需要使用 sharp. Its work fine on my workspace but if I deploymeny via docker then I get error. I am implementation all steps.
Error: 'linux-x64' binaries cannot be used on the 'linuxmusl-x64' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'linuxmusl-x64' platform.
我认为 sharp 是在第一次安装时预构建的。用的是我电脑的架构(darwin,arm) 但是在docker上运行的时候,虽然重新build了,但是作品讲的是我电脑的架构
我试过了
删除我工作区中的 node_modules 文件夹。 - 找不到纱线 pm2
npm 安装 docker 运行。 - 权限问题
我的Docker文件:
FROM node:alpine
RUN mkdir -p /usr/src/node-app && chown -R node:node /usr/src/node-app
WORKDIR /usr/src/node-app
COPY package.json yarn.lock ./
USER node
RUN npm install --pure-lockfile
RUN npm install sharp --ignore-scripts=false
COPY --chown=node:node . .
EXPOSE 3050
我的。docker忽略。
node_modules
**/node_modules
npm-debug.log
Dockerfile
.dockerignore
.git
.gitignore
docker build .
当我这样做时,我看到 docker 日志中加载了我的服务器的 sharp。
found 11 vulnerabilities (6 moderate, 5 high)
run `npm audit fix` to fix them, or `npm audit` for details
Removing intermediate container e5ad8008eebd
---> 906e268b6fc3
Step 7/9 : RUN npm install sharp --ignore-scripts=false
---> Running in 933338813b5d
> sharp@0.27.0 install /usr/src/node-app/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Using cached /home/node/.npm/_libvips/libvips-8.10.5-linuxmusl-x64.tar.br
npm WARN @apidevtools/swagger-parser@10.0.2 requires a peer of openapi-types@>=7 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.19.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.1 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ sharp@0.27.0
updated 1 package and audited 1348 packages in 20.689s
84 packages are looking for funding
run `npm fund` for details
found 11 vulnerabilities (6 moderate, 5 high)
run `npm audit fix` to fix them, or `npm audit` for details
Removing intermediate container 933338813b5d
---> 838713a4cebb
Step 8/9 : COPY --chown=node:node . .
---> eb755fc2589e
Step 9/9 : EXPOSE 3050
---> Running in bf0a5c9e96c6
Removing intermediate container bf0a5c9e96c6
---> 347f113598fd
Successfully built 347f113598fd
我的Docker-撰写日志
mongodb_1 | 2021-01-09T19:31:15.802+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=a8281f9d01ef
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] db version v4.2.1
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] git version: edf6d45851c0b9ee15548f0f847df141764a317e
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] allocator: tcmalloc
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] modules: none
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] build environment:
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] distmod: ubuntu1804
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] distarch: x86_64
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] target_arch: x86_64
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] options: { net: { bindIp: "0.0.0.0", port: 27017 }, security: { authorization: "enabled" }, storage: { dbPath: "/data/db" } }
mongodb_1 | 2021-01-09T19:31:15.816+0000 I STORAGE [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
mongodb_1 | 2021-01-09T19:31:15.816+0000 I STORAGE [initandlisten]
mongodb_1 | 2021-01-09T19:31:15.816+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
mongodb_1 | 2021-01-09T19:31:15.816+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
mongodb_1 | 2021-01-09T19:31:15.816+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=457M,cache_overflow=(file_max=0M),session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],
mongodb_1 | 2021-01-09T19:31:17.154+0000 I STORAGE [initandlisten] WiredTiger message [1610220677:154424][1:0x7f96e9f8db00], txn-recover: Recovering log 194 through 195
api_node-app_1 exited with code 0
mongodb_1 | 2021-01-09T19:31:17.389+0000 I STORAGE [initandlisten] WiredTiger message [1610220677:389583][1:0x7f96e9f8db00], txn-recover: Recovering log 195 through 195
mongodb_1 | 2021-01-09T19:31:17.527+0000 I STORAGE [initandlisten] WiredTiger message [1610220677:527496][1:0x7f96e9f8db00], txn-recover: Main recovery loop: starting at 194/6016 to 195/256
mongodb_1 | 2021-01-09T19:31:17.643+0000 I STORAGE [initandlisten] WiredTiger message [1610220677:643739][1:0x7f96e9f8db00], txn-recover: Recovering log 194 through 195
mongodb_1 | 2021-01-09T19:31:17.722+0000 I STORAGE [initandlisten] WiredTiger message [1610220677:722144][1:0x7f96e9f8db00], txn-recover: Recovering log 195 through 195
mongodb_1 | 2021-01-09T19:31:17.784+0000 I STORAGE [initandlisten] WiredTiger message [1610220677:784868][1:0x7f96e9f8db00], txn-recover: Set global recovery timestamp: (0,0)
mongodb_1 | 2021-01-09T19:31:17.812+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
mongodb_1 | 2021-01-09T19:31:17.825+0000 I STORAGE [initandlisten] Timestamp monitor starting
mongodb_1 | 2021-01-09T19:31:17.827+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
mongodb_1 | 2021-01-09T19:31:17.828+0000 I CONTROL [initandlisten]
mongodb_1 | 2021-01-09T19:31:17.844+0000 I SHARDING [initandlisten] Marking collection local.system.replset as collection version: <unsharded>
mongodb_1 | 2021-01-09T19:31:17.847+0000 I STORAGE [initandlisten] Flow Control is enabled on this deployment.
mongodb_1 | 2021-01-09T19:31:17.848+0000 I SHARDING [initandlisten] Marking collection admin.system.roles as collection version: <unsharded>
mongodb_1 | 2021-01-09T19:31:17.849+0000 I SHARDING [initandlisten] Marking collection admin.system.version as collection version: <unsharded>
mongodb_1 | 2021-01-09T19:31:17.850+0000 I SHARDING [initandlisten] Marking collection local.startup_log as collection version: <unsharded>
mongodb_1 | 2021-01-09T19:31:17.851+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
mongodb_1 | 2021-01-09T19:31:17.855+0000 I SHARDING [LogicalSessionCacheRefresh] Marking collection config.system.sessions as collection version: <unsharded>
mongodb_1 | 2021-01-09T19:31:17.856+0000 I NETWORK [initandlisten] Listening on /tmp/mongodb-27017.sock
mongodb_1 | 2021-01-09T19:31:17.857+0000 I NETWORK [initandlisten] Listening on 0.0.0.0
mongodb_1 | 2021-01-09T19:31:17.857+0000 I NETWORK [initandlisten] waiting for connections on port 27017
mongodb_1 | 2021-01-09T19:31:17.858+0000 I SHARDING [LogicalSessionCacheReap] Marking collection config.transactions as collection version: <unsharded>
mongodb_1 | 2021-01-09T19:31:18.004+0000 I SHARDING [ftdc] Marking collection local.oplog.rs as collection version: <unsharded>
我想,我需要在 docker 上安装 sharp 以进行预构建过程。
我不明白 docker 是如何运作的。这与我生活中的业余性有关。
关系问题:
我需要使用 sharp. Its work fine on my workspace but if I deploymeny via docker then I get error. I am implementation all steps.
Error: 'linux-x64' binaries cannot be used on the 'linuxmusl-x64' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'linuxmusl-x64' platform.
我认为 sharp 是在第一次安装时预构建的。用的是我电脑的架构(darwin,arm) 但是在docker上运行的时候,虽然重新build了,但是作品讲的是我电脑的架构
我试过了 删除我工作区中的 node_modules 文件夹。 - 找不到纱线 pm2 npm 安装 docker 运行。 - 权限问题
我的Docker文件:
FROM node:alpine
RUN mkdir -p /usr/src/node-app && chown -R node:node /usr/src/node-app
WORKDIR /usr/src/node-app
COPY package.json yarn.lock ./
USER node
RUN npm install --pure-lockfile
RUN npm install sharp --ignore-scripts=false
COPY --chown=node:node . .
EXPOSE 3050
我的。docker忽略。
node_modules
**/node_modules
npm-debug.log
Dockerfile
.dockerignore
.git
.gitignore
docker build .
当我这样做时,我看到 docker 日志中加载了我的服务器的 sharp。
found 11 vulnerabilities (6 moderate, 5 high)
run `npm audit fix` to fix them, or `npm audit` for details
Removing intermediate container e5ad8008eebd
---> 906e268b6fc3
Step 7/9 : RUN npm install sharp --ignore-scripts=false
---> Running in 933338813b5d
> sharp@0.27.0 install /usr/src/node-app/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Using cached /home/node/.npm/_libvips/libvips-8.10.5-linuxmusl-x64.tar.br
npm WARN @apidevtools/swagger-parser@10.0.2 requires a peer of openapi-types@>=7 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.19.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.1 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ sharp@0.27.0
updated 1 package and audited 1348 packages in 20.689s
84 packages are looking for funding
run `npm fund` for details
found 11 vulnerabilities (6 moderate, 5 high)
run `npm audit fix` to fix them, or `npm audit` for details
Removing intermediate container 933338813b5d
---> 838713a4cebb
Step 8/9 : COPY --chown=node:node . .
---> eb755fc2589e
Step 9/9 : EXPOSE 3050
---> Running in bf0a5c9e96c6
Removing intermediate container bf0a5c9e96c6
---> 347f113598fd
Successfully built 347f113598fd
我的Docker-撰写日志
mongodb_1 | 2021-01-09T19:31:15.802+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=a8281f9d01ef
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] db version v4.2.1
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] git version: edf6d45851c0b9ee15548f0f847df141764a317e
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] allocator: tcmalloc
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] modules: none
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] build environment:
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] distmod: ubuntu1804
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] distarch: x86_64
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] target_arch: x86_64
mongodb_1 | 2021-01-09T19:31:15.815+0000 I CONTROL [initandlisten] options: { net: { bindIp: "0.0.0.0", port: 27017 }, security: { authorization: "enabled" }, storage: { dbPath: "/data/db" } }
mongodb_1 | 2021-01-09T19:31:15.816+0000 I STORAGE [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
mongodb_1 | 2021-01-09T19:31:15.816+0000 I STORAGE [initandlisten]
mongodb_1 | 2021-01-09T19:31:15.816+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
mongodb_1 | 2021-01-09T19:31:15.816+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
mongodb_1 | 2021-01-09T19:31:15.816+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=457M,cache_overflow=(file_max=0M),session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],
mongodb_1 | 2021-01-09T19:31:17.154+0000 I STORAGE [initandlisten] WiredTiger message [1610220677:154424][1:0x7f96e9f8db00], txn-recover: Recovering log 194 through 195
api_node-app_1 exited with code 0
mongodb_1 | 2021-01-09T19:31:17.389+0000 I STORAGE [initandlisten] WiredTiger message [1610220677:389583][1:0x7f96e9f8db00], txn-recover: Recovering log 195 through 195
mongodb_1 | 2021-01-09T19:31:17.527+0000 I STORAGE [initandlisten] WiredTiger message [1610220677:527496][1:0x7f96e9f8db00], txn-recover: Main recovery loop: starting at 194/6016 to 195/256
mongodb_1 | 2021-01-09T19:31:17.643+0000 I STORAGE [initandlisten] WiredTiger message [1610220677:643739][1:0x7f96e9f8db00], txn-recover: Recovering log 194 through 195
mongodb_1 | 2021-01-09T19:31:17.722+0000 I STORAGE [initandlisten] WiredTiger message [1610220677:722144][1:0x7f96e9f8db00], txn-recover: Recovering log 195 through 195
mongodb_1 | 2021-01-09T19:31:17.784+0000 I STORAGE [initandlisten] WiredTiger message [1610220677:784868][1:0x7f96e9f8db00], txn-recover: Set global recovery timestamp: (0,0)
mongodb_1 | 2021-01-09T19:31:17.812+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
mongodb_1 | 2021-01-09T19:31:17.825+0000 I STORAGE [initandlisten] Timestamp monitor starting
mongodb_1 | 2021-01-09T19:31:17.827+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
mongodb_1 | 2021-01-09T19:31:17.828+0000 I CONTROL [initandlisten]
mongodb_1 | 2021-01-09T19:31:17.844+0000 I SHARDING [initandlisten] Marking collection local.system.replset as collection version: <unsharded>
mongodb_1 | 2021-01-09T19:31:17.847+0000 I STORAGE [initandlisten] Flow Control is enabled on this deployment.
mongodb_1 | 2021-01-09T19:31:17.848+0000 I SHARDING [initandlisten] Marking collection admin.system.roles as collection version: <unsharded>
mongodb_1 | 2021-01-09T19:31:17.849+0000 I SHARDING [initandlisten] Marking collection admin.system.version as collection version: <unsharded>
mongodb_1 | 2021-01-09T19:31:17.850+0000 I SHARDING [initandlisten] Marking collection local.startup_log as collection version: <unsharded>
mongodb_1 | 2021-01-09T19:31:17.851+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
mongodb_1 | 2021-01-09T19:31:17.855+0000 I SHARDING [LogicalSessionCacheRefresh] Marking collection config.system.sessions as collection version: <unsharded>
mongodb_1 | 2021-01-09T19:31:17.856+0000 I NETWORK [initandlisten] Listening on /tmp/mongodb-27017.sock
mongodb_1 | 2021-01-09T19:31:17.857+0000 I NETWORK [initandlisten] Listening on 0.0.0.0
mongodb_1 | 2021-01-09T19:31:17.857+0000 I NETWORK [initandlisten] waiting for connections on port 27017
mongodb_1 | 2021-01-09T19:31:17.858+0000 I SHARDING [LogicalSessionCacheReap] Marking collection config.transactions as collection version: <unsharded>
mongodb_1 | 2021-01-09T19:31:18.004+0000 I SHARDING [ftdc] Marking collection local.oplog.rs as collection version: <unsharded>
我想,我需要在 docker 上安装 sharp 以进行预构建过程。 我不明白 docker 是如何运作的。这与我生活中的业余性有关。
关系问题: