Google Cloud 运行:将源文件夹从 ./ 更改为构建时 COPY 失败

Google Cloud Run: COPY fails when changing source folder from ./ to build

$ gcloud builds submit --tag gcr.io/projectname/testserver
// ... works fine until the COPY step:

Step 6/7 : COPY build ./
COPY failed: stat /var/lib/docker/tmp/docker-builder653325957/build: no such file or directory
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: exit status 1

上面列出的构建文件夹 /var/lib/docker/tmp/docker-builder653325957/build 不是本地文件夹。 Cloud Builder 是否会创建该格式的临时文件夹?

如何让它复制我的本地 build 文件夹?

我也试过 COPY ./build ./ 但 CLI 输出是一样的

下面的 Dockerfile。

FROM node:12-slim

# Create app folder
WORKDIR /usr/src/app

# Install app deps. Copy the lock file
COPY package*.json ./
RUN npm install

ENV SCOPES=removed \
    SHOPIFY_API_KEY=removed \
    SHOPIFY_API_SECRET=removed \
    CLIENT_APP_URL=removed

COPY build ./
CMD ["node", "server.js"]


gcloud 命令使用 .gitignore.gcloudignore 文件来确定要包含在 Docker 构建中的文件和目录。如果您的 build 目录在这些文件中的任何一个中列出,则无法将其复制到您的容器映像中。