From 6741473ab09597899bc2ce9c9b6be9ea739e9ee2 Mon Sep 17 00:00:00 2001 From: Adam Ross Date: Thu, 5 Sep 2019 15:32:43 -0700 Subject: [PATCH 1/2] run: use node-slim --- run/image-processing/Dockerfile | 8 ++++---- run/logging-manual/Dockerfile | 8 ++++---- run/logging-manual/package.json | 1 - run/pubsub/Dockerfile | 8 ++++---- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/run/image-processing/Dockerfile b/run/image-processing/Dockerfile index 70a617b235..9f366cc41e 100644 --- a/run/image-processing/Dockerfile +++ b/run/image-processing/Dockerfile @@ -2,9 +2,9 @@ # Use of this source code is governed by the Apache 2.0 # license that can be found in the LICENSE file. -# Use the official Node.js 10 image. +# Use the official lightweight Node.js 10 image. # https://hub.docker.com/_/node -FROM node:10 +FROM node:10-slim # [START run_imageproc_dockerfile_imagemagick] @@ -27,9 +27,9 @@ WORKDIR /usr/src/app COPY package*.json ./ # Install dependencies. -RUN npm install --production -# If you add a package-lock.json, speed your build by switching to 'npm ci'. +# If you add a package-lock.json speed your build by switching to 'npm ci'. # RUN npm ci --only=production +RUN npm install --production # Copy local code to the container image. COPY . . diff --git a/run/logging-manual/Dockerfile b/run/logging-manual/Dockerfile index ca7b347297..4287d4eb07 100644 --- a/run/logging-manual/Dockerfile +++ b/run/logging-manual/Dockerfile @@ -2,9 +2,9 @@ # Use of this source code is governed by the Apache 2.0 # license that can be found in the LICENSE file. -# Use the official Node.js 10 image. +# Use the official lightweight Node.js 10 image. # https://hub.docker.com/_/node -FROM node:10 +FROM node:10-slim # Create and change to the app directory. WORKDIR /usr/src/app @@ -15,9 +15,9 @@ WORKDIR /usr/src/app COPY package*.json ./ # Install dependencies. -RUN npm install -# For production deploys, add a package-lock.json and use 'npm ci'. +# If you add a package-lock.json speed your build by switching to 'npm ci'. # RUN npm ci --only=production +RUN npm install --production # Copy local code to the container image. COPY . . diff --git a/run/logging-manual/package.json b/run/logging-manual/package.json index 05bd1a2e1d..dc4e5e0373 100644 --- a/run/logging-manual/package.json +++ b/run/logging-manual/package.json @@ -20,7 +20,6 @@ }, "devDependencies": { "@google-cloud/logging": "^5.1.2", - "@google-cloud/nodejs-repo-tools": "^3.3.0", "mocha": "^6.1.4" } } diff --git a/run/pubsub/Dockerfile b/run/pubsub/Dockerfile index 7bc513b5a6..7b31f9ad64 100644 --- a/run/pubsub/Dockerfile +++ b/run/pubsub/Dockerfile @@ -4,9 +4,9 @@ # [START run_pubsub_dockerfile] -# Use the official Node.js 10 image. +# Use the official lightweight Node.js 10 image. # https://hub.docker.com/_/node -FROM node:10 +FROM node:10-slim # Create and change to the app directory. WORKDIR /usr/src/app @@ -17,9 +17,9 @@ WORKDIR /usr/src/app COPY package*.json ./ # Install dependencies. -RUN npm install --production -# If you add a package-lock.json, speed your build by switching to 'npm ci'. +# If you add a package-lock.json speed your build by switching to 'npm ci'. # RUN npm ci --only=production +RUN npm install --production # Copy local code to the container image. COPY . . From baeaee2648317abe7430cb833ca81c314865b736 Mon Sep 17 00:00:00 2001 From: Adam Ross Date: Thu, 5 Sep 2019 18:57:15 -0700 Subject: [PATCH 2/2] run: sample deps docs swap --- run/image-processing/README.md | 3 +++ run/pubsub/.envrc | 3 +++ run/pubsub/README.md | 5 +---- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 run/pubsub/.envrc diff --git a/run/image-processing/README.md b/run/image-processing/README.md index 63b44c3b39..b070cfc853 100644 --- a/run/image-processing/README.md +++ b/run/image-processing/README.md @@ -10,6 +10,9 @@ For more details on how to work with this sample read the [Google Cloud Run Node * **express**: Web server framework * **body-parser**: express middleware for request payload processing +* **[gm](https://github.com/aheckmann/gm#readme)**: ImageMagick integration library. +* **@google-cloud/storage**: Google Cloud Storage client library. +* **@google-cloud/vision**: Cloud Vision API client library. ## Environment Variables diff --git a/run/pubsub/.envrc b/run/pubsub/.envrc new file mode 100644 index 0000000000..ff9b80fe0e --- /dev/null +++ b/run/pubsub/.envrc @@ -0,0 +1,3 @@ +export GOOGLE_CLOUD_PROJECT=adamross-svls-kibble +export SERVICE_NAME=pubsub-tutorial +export DOCKER_IMAGE_TAG=nodejs diff --git a/run/pubsub/README.md b/run/pubsub/README.md index fadedf4fdf..8de08806f8 100644 --- a/run/pubsub/README.md +++ b/run/pubsub/README.md @@ -9,7 +9,4 @@ For more details on how to work with this sample read the [Google Cloud Run Node ## Dependencies * **express**: Web server framework. -* **body-parser**: express middleware for request payload processing. -* **[gm](https://github.com/aheckmann/gm#readme)**: ImageMagick integration library. -* **@google-cloud/storage**: Google Cloud Storage client library. -* **@google-cloud/vision**: Cloud Vision API client library. \ No newline at end of file +* **body-parser**: express middleware for request payload processing. \ No newline at end of file