我想从 CloudRun 连接 Filestore,我已经在运行节点应用程序和挂载命令以连接到文件存储的 run.sh 脚本中定义了它,我的节点应用程序在云运行上运行但无法挂载到文件存储,我已附加到我的 nodejs 代码的链接,也在我的脚本中 node 命令后没有其他命令运行。我正在关注官方的Google 文档。
我的运行脚本有问题:
node /app/index.js //working on cloudrun
mkdir -p $MNT_DIR //not working on cloudrun
chmod 775 $MNT_DIR //not working on cloudrun
echo "Mounting Cloud Filestore." //not working on cloudrun
mount --verbose -t nfs -o vers=3 -o nolock 10.67.157.122:/filestore_vol1/test/testing/ $MNT_DIR //not working
echo "Mounting completed." //not working on cloudrun
注意:- 如果我在回显“安装完成”之后放置节点 /app/index.js。//node 应用程序没有在 cloudrun 上启动
我在这里附上我的代码 URL 。
我的 Docker 文件:
FROM node:slim
# Install system dependencies
RUN apt-get update -y && apt-get install -y \
tini \
nfs-common \
procps \
&& apt-get clean
# Set working directory
WORKDIR /app
# Set fallback mount directory
ENV MNT_DIR /app2
# Copy package.json to the working directory
COPY package*.json ./
# Copy all codes to the working directory
COPY . .
# Ensure the script is executable
RUN chmod +x /app/run.sh
# Use tini to manage zombie processes and signal forwarding
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
ENV PORT=8080
EXPOSE 8080
EXPOSE 2049
# Pass the startup script as arguments to tini
CMD ["/app/run.sh"]
# My run.sh script file
#!/bin/bash
set -eo pipefail
node /app/index.js
# Create mount directory for service.
mkdir -p $MNT_DIR
chmod 775 $MNT_DIR
echo "Mounting Cloud Filestore."
mount --verbose -t nfs -o vers=3 -o nolock 10.x.x.122:/filestore_vol1/test/testing/ $MNT_DIR
echo "Mounting completed."
# Exit immediately when one of the background processes terminate.
wait -n
#main goal is to mount cloud run with filestore and start my node app