-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into renovate/gts-5.x
- Loading branch information
Showing
3 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# [START cloudrun_fuse_dockerfile] | ||
|
||
# Use the official Node.js image. | ||
# https://hub.docker.com/_/node | ||
FROM node:20-slim | ||
|
||
# Install system dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
gnupg \ | ||
lsb-release \ | ||
tini && \ | ||
gcsFuseRepo=gcsfuse-`lsb_release -c -s` && \ | ||
echo "deb http://packages.cloud.google.com/apt $gcsFuseRepo main" | \ | ||
tee /etc/apt/sources.list.d/gcsfuse.list && \ | ||
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ | ||
apt-key add - && \ | ||
apt-get update && \ | ||
apt-get install -y gcsfuse && \ | ||
apt-get clean | ||
|
||
# Set fallback mount directory | ||
ENV MNT_DIR /mnt/gcs | ||
|
||
# Copy local code to the container image. | ||
ENV APP_HOME /app | ||
WORKDIR $APP_HOME | ||
COPY package*.json ./ | ||
|
||
# Install production dependencies. | ||
RUN npm install --only=production | ||
|
||
# Copy local code to the container image. | ||
COPY . ./ | ||
|
||
# Ensure the script is executable | ||
RUN chmod +x /app/gcsfuse_run.sh | ||
|
||
# Use tini to manage zombie processes and signal forwarding | ||
# https://github.com/krallin/tini | ||
ENTRYPOINT ["/usr/bin/tini", "--"] | ||
|
||
# Pass the wrapper script as arguments to tini | ||
CMD ["/app/gcsfuse_run.sh"] | ||
# [END cloudrun_fuse_dockerfile] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# [START cloudrun_fuse_script] | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
# Create mount directory for service | ||
mkdir -p $MNT_DIR | ||
|
||
echo "Mounting GCS Fuse." | ||
gcsfuse --debug_gcs --debug_fuse $BUCKET $MNT_DIR | ||
echo "Mounting completed." | ||
|
||
# Start the application | ||
node index.js & | ||
|
||
# Exit immediately when one of the background processes terminate. | ||
wait -n | ||
# [END cloudrun_fuse_script] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters