From d3bdac5334e40b472e4899a2c52f2ecb4eb66324 Mon Sep 17 00:00:00 2001 From: srinandan <13950006+srinandan@users.noreply.github.com> Date: Fri, 18 Aug 2023 12:15:32 -0700 Subject: [PATCH] docs: update docs for docker #262 --- Dockerfile | 4 +++- README.md | 30 ++++++++++++++++++++++++++++++ cloud-builder.yaml | 2 +- test/sample-cloud-build.yaml | 26 ++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 test/sample-cloud-build.yaml diff --git a/Dockerfile b/Dockerfile index 82c0cb9c5..034127160 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,4 +38,6 @@ FROM gcr.io/distroless/static-debian11:debug COPY --from=builder /go/bin/apigeecli /usr/local/bin/apigeecli COPY LICENSE.txt / COPY third-party-licenses.txt / -COPY --from=jq /jq /usr/local/bin/jq \ No newline at end of file +COPY --from=jq /jq /usr/local/bin/jq + +ENTRYPOINT [ "apigeecli" ] \ No newline at end of file diff --git a/README.md b/README.md index d931799a9..1596b7c53 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,36 @@ The lastest container version for apigeecli can be downloaded via docker pull ghcr.io/apigee/apigeecli:latest ``` +### Using docker to run commands locally + +```sh +docker run -ti ghcr.io/apigee/apigeecli:latest orgs list -t $token +``` + +### Using apigeecli with Cloud Build + +```yaml +steps: +- id: 'Run apigeecli commands' + name: ghcr.io/apigee/apigeecli:latest + entrypoint: 'sh' + args: + - -c + - | + #setup preferences + apigeecli prefs set --nocheck=true -o $PROJECT_ID + apigeecli token cache --metadata-token + + # run other commands here + apigeecli orgs list +``` + +### Access shell + +```sh +docker run -ti --entrypoint sh ghcr.io/apigee/apigeecli:latest +``` + See this [page](https://github.com/apigee/apigeecli/pkgs/container/apigeecli) for other versions. ## What you need to know about apigeecli diff --git a/cloud-builder.yaml b/cloud-builder.yaml index a7bc25cca..00e50eebb 100644 --- a/cloud-builder.yaml +++ b/cloud-builder.yaml @@ -18,7 +18,7 @@ steps: args: ['build', '-t', 'gcr.io/$PROJECT_ID/apigeecli', '-f', 'Dockerfile', '.'] # Push the container image to Container Registry - name: 'gcr.io/cloud-builders/docker' - args: ['push', 'gcr.io/$PROJECT_ID/apigeecli-builder'] + args: ['push', 'gcr.io/$PROJECT_ID/apigeecli'] options: env: ["DEBUG=true"] machineType: N1_HIGHCPU_8 diff --git a/test/sample-cloud-build.yaml b/test/sample-cloud-build.yaml new file mode 100644 index 000000000..dc8bf9bca --- /dev/null +++ b/test/sample-cloud-build.yaml @@ -0,0 +1,26 @@ +# 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. + +steps: +- id: 'Run apigeecli commands' + name: ghcr.io/apigee/apigeecli:latest + entrypoint: 'sh' + args: + - -c + - | + #setup preferences + apigeecli prefs set --nocheck=true -o $PROJECT_ID + apigeecli token cache --metadata-token + + apigeecli orgs list \ No newline at end of file