Skip to content

Commit

Permalink
nodejs: use Docker node version that runs in non-root (#59)
Browse files Browse the repository at this point in the history
* use node docker tag that runs in node user, not root

* set npm config prefix to a dir. accessible by user `node`, so npm link works
  • Loading branch information
jkwlui authored and JustinBeckwith committed Sep 5, 2018
1 parent e5732cc commit 851e31f
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion synthtool/gcp/templates/node_library/.kokoro/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build_file: "{{ metadata['repository_name'] }}/.kokoro/trampoline.sh"
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:10"
value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user"
}
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build_file: "{{ metadata['repository_name'] }}/.kokoro/trampoline.sh"
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:10"
value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user"
}
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build_file: "{{ metadata['repository_name'] }}/.kokoro/trampoline.sh"
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:6"
value: "gcr.io/cloud-devrel-kokoro-resources/node:6-user"
}
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build_file: "{{ metadata['repository_name'] }}/.kokoro/trampoline.sh"
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:8"
value: "gcr.io/cloud-devrel-kokoro-resources/node:8-user"
}
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
Expand Down
2 changes: 2 additions & 0 deletions synthtool/gcp/templates/node_library/.kokoro/docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

set -xeo pipefail

export NPM_CONFIG_PREFIX=/home/node/.npm-global

cd $(dirname $0)/..

npm install
Expand Down
2 changes: 2 additions & 0 deletions synthtool/gcp/templates/node_library/.kokoro/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

set -xeo pipefail

export NPM_CONFIG_PREFIX=/home/node/.npm-global

cd $(dirname $0)/..

npm install
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build_file: "{{ metadata['repository_name'] }}/.kokoro/trampoline.sh"
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:10"
value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user"
}
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build_file: "{{ metadata['repository_name'] }}/.kokoro/trampoline.sh"
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:6"
value: "gcr.io/cloud-devrel-kokoro-resources/node:6-user"
}
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build_file: "{{ metadata['repository_name'] }}/.kokoro/trampoline.sh"
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:8"
value: "gcr.io/cloud-devrel-kokoro-resources/node:8-user"
}
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
Expand Down
2 changes: 2 additions & 0 deletions synthtool/gcp/templates/node_library/.kokoro/samples-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

set -xeo pipefail

export NPM_CONFIG_PREFIX=/home/node/.npm-global

# Setup service account credentials.
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
export GCLOUD_PROJECT=long-door-651
Expand Down
2 changes: 2 additions & 0 deletions synthtool/gcp/templates/node_library/.kokoro/system-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

set -xeo pipefail

export NPM_CONFIG_PREFIX=/home/node/.npm-global

# Setup service account credentials.
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json

Expand Down
2 changes: 2 additions & 0 deletions synthtool/gcp/templates/node_library/.kokoro/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

set -xeo pipefail

export NPM_CONFIG_PREFIX=/home/node/.npm-global

cd $(dirname $0)/..

npm install
Expand Down

0 comments on commit 851e31f

Please sign in to comment.