我正在尝试使用execSync从我的Node代码中卷曲端点(因为我需要同步执行),它返回大约90KB的有效负载。这在本地完全正常,但在Docker容器中,以下行挂起:
const { execSync } = require('child_process');
return execSync(
`curl -X DELETE "https://foo.com"`
);
这也是我的Dockerfile设置:
# Base image to match prod node version (deploy-swarm: 6.9.4) (Jenkins2: 4.2.6)
FROM node:6.9.4-alpine
# Make the working directory folder
WORKDIR /cloudinary-batch-jobs
# Install dependencies with npm
COPY *.npmrc package.json package-lock.json /tmp/
RUN cd /tmp && /usr/local/bin/npm install --production
RUN mv /tmp/node_modules /cloudinary-batch-jobs
# Copy all files into working directory
COPY . /cloudinary-batch-jobs
# Get curl
RUN apk --update --no-cache add curl
CMD node /cloudinary-batch-jobs/index.js