node.js - 在 docker 中将 google cloud sdk 容器与 nodejs 应用程序相结合
问题描述
我是 docker 新手,我正在尝试使用本指南使用 dscc-gen 和 nodejs 构建 datastudio 可视化。 https://developers.google.com/datastudio/visualization/local-dev
运行我的 dockerfile 时,出现以下错误:
Step 5/8 : RUN sh -c '/bin/echo' -e 'calendar-chart\ngs://datastudio-visualisations/calendar-chart-dev\ngs://datastudio-visualisations/calendar-chart-prod\n' | npx @google/dscc-gen viz
---> Running in 9316cb8dd84e
npx: installed 318 in 22.446s
ERROR: gsutil is not installed, but is needed for the viz template.
Install gsutil (https://cloud.google.com/storage/docs/gsutil_install), then re-run this command to continue.
No files have been created.
The command '/bin/sh -c sh -c '/bin/echo' -e 'calendar-chart\ngs://datastudio-visualisations/calendar-chart-dev\ngs://datastudio-visualisations/calendar-chart-prod\n' | npx @google/dscc-gen viz' returned a non-zero code: 1
gsutil 存在于 docker hub 中的 google cloud sdk 中。https://hub.docker.com/r/google/cloud-sdk
如何让 sdk 在我的 docker 文件中工作?因为据我所知,它并不是真正运行的服务器。只是云平台的“连接器”。
这是我在 de nodejs 应用程序中的 Dockerfile。
FROM node:current
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install
RUN sh -c '/bin/echo' -e 'calendar-chart\ngs://url-dev\ngs://url-prod\n' | npx @google/dscc-gen viz
# Bundle app source
COPY . .
CMD [ "npm", "run", "start"]
EXPOSE 8080
我知道如果您正在运行服务器,您可以使用 docker compose。这可能是一个多阶段构建,但我被困在我需要在哪里引用的文件夹上。
解决方案
推荐阅读
- google-chrome - 没有 src 的 iframe 的 Content-Security-Policy (CSP) 框架祖先
- python - 无法通过 os.environ.get 读取使用 PowerShell 设置的环境变量
- c++ - Xcode无法在c ++中引用子文件夹内的图像
- web-applications - 如何估计 Web 应用程序的 RAM 和 CPU 使用率?
- python - 如何在 jupyter 中使用 RMagic 进行控制台文本输出
- sql - 通过 Proc SQL 语句将列添加到 SAS
- python - 具有多个 Python 依赖项的模板数据流
- asp.net - 命名空间“Microsoft”中不存在类型或命名空间名称“EntityFrameworkCore”
- java - DateTime 转换为 Xa6maSA 格式
- javascript - 如何在 undici 中使用经过身份验证的代理