Skip to content

Commit

Permalink
build: install dependencies directly from the repo (#1862)
Browse files Browse the repository at this point in the history
* build: install dependencies directly from the repo
  • Loading branch information
sofisl committed Sep 21, 2023
1 parent b79c38d commit 8374995
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
7 changes: 1 addition & 6 deletions docker/owlbot/nodejs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# build from the root of this repo:
# docker build -t gcr.io/repo-automation-bots/owlbot-nodejs -f docker/owlbot/nodejs/Dockerfile .
FROM python:3.10.12-bookworm

WORKDIR /

###################### Install nodejs.
Expand Down Expand Up @@ -46,11 +45,7 @@ COPY post-processor-changes.txt /post-processor-changes.txt
RUN find /synthtool -exec chmod a+r {} \;
RUN find /synthtool -type d -exec chmod a+x {} \;

# Install dependencies used for post processing:
# * gts/typescript are used for linting.
# * google-gax and gapic-tools are used for compiling protos.
RUN cd /synthtool && mkdir node_modules && npm i gts@5.0.0 google-gax@4.0.3 \
typescript@5.1.6 @google-cloud/typeless-sample-bot@1.3.3 gapic-tools@0.1.8
RUN cd /synthtool && mkdir node_modules && npm install @google-cloud/typeless-sample-bot@1.3.3

ENTRYPOINT [ "/bin/bash" ]
CMD [ "/synthtool/docker/owlbot/nodejs/entrypoint.sh" ]
2 changes: 2 additions & 0 deletions docker/owlbot/nodejs/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

set -ex

npm i --only=dev --ignore-scripts

if [ -f owlbot.py ]; then
python owlbot.py
else
Expand Down
6 changes: 3 additions & 3 deletions synthtool/languages/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ def fix_hermetic(hide_output=False):
"""
logger.debug("Copy eslint config")
shell.run(
["cp", "-r", f"{_TOOLS_DIRECTORY}/node_modules", "."],
["cp", "-r", "/node_modules", "."],
check=True,
hide_output=hide_output,
)
logger.debug("Running fix...")
shell.run(
[f"{_TOOLS_DIRECTORY}/node_modules/.bin/gts", "fix"],
["/node_modules/.bin/gts", "fix"],
check=False,
hide_output=hide_output,
)
Expand All @@ -249,7 +249,7 @@ def compile_protos_hermetic(hide_output=False):
"""
logger.debug("Compiling protos...")
shell.run(
[f"{_TOOLS_DIRECTORY}/node_modules/.bin/compileProtos", "src"],
["/node_modules/.bin/compileProtos", "src"],
check=True,
hide_output=hide_output,
)
Expand Down

0 comments on commit 8374995

Please sign in to comment.