Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: update to pack v0.17.0 #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions build_scripts/pack.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2021 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.

FROM busybox
ARG PACK_VERSION=v0.17.0
RUN wget -q -O- https://github.com/buildpacks/pack/releases/download/${PACK_VERSION}/pack-${PACK_VERSION}-linux.tgz | tar zx

FROM gcr.io/distroless/base
ENTRYPOINT ["/pack"]
COPY --from=0 /pack /
6 changes: 3 additions & 3 deletions ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ Create the buildpack builder:
cd functions-framework-cpp
docker build -t gcf-cpp-develop -f build_scripts/Dockerfile .
docker build -t gcf-cpp-runtime --target gcf-cpp-runtime -f build_scripts/Dockerfile build_scripts
pack create-builder gcf-cpp-builder:bionic --config pack/builder.toml
pack trust-builder gcf-cpp-builder:bionic
pack set-default-builder gcf-cpp-builder:bionic
pack builder create gcf-cpp-builder:bionic --config pack/builder.toml
pack config trusted-builders add gcf-cpp-builder:bionic
pack config default-builder gcf-cpp-builder:bionic
```

Create containers for the Hello World examples:
Expand Down
20 changes: 5 additions & 15 deletions ci/build-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,16 @@ options:
diskSizeGb: 512

steps:
# Create a docker image for the buildpacks `pack` tool
- name: 'gcr.io/cloud-builders/git'
args: [
'clone', '--depth=1',
'https://github.com/GoogleCloudPlatform/cloud-builders-community',
'third_party/cloud-builders-community',
]
waitFor: ['-']
id: 'clone-cloud-builders-community'
# Workaround a kaniko bug using the "edge" builder:
# https://github.com/GoogleContainerTools/kaniko/issues/1058
- name: 'gcr.io/kaniko-project/executor:edge'
args: [
"--context=dir:///workspace/third_party/cloud-builders-community/pack/",
"--dockerfile=Dockerfile",
"--context=dir:///workspace/build_scripts",
"--dockerfile=build_scripts/pack.Dockerfile",
"--destination=gcr.io/${PROJECT_ID}/pack:${SHORT_SHA}",
"--cache=true",
"--cache-ttl=48h"
]
waitFor: ['clone-cloud-builders-community']

# Create the docker images for the buildpacks builder.
- name: 'gcr.io/kaniko-project/executor:edge'
Expand Down Expand Up @@ -59,11 +49,11 @@ steps:

# Create the buildpacks builder, and make it the default.
- name: 'gcr.io/${PROJECT_ID}/pack:${SHORT_SHA}'
args: ['create-builder', 'gcf-cpp-builder:bionic', '--builder-config', 'pack/builder.toml', ]
args: ['builder', 'create', 'gcf-cpp-builder:bionic', '--config', 'pack/builder.toml', ]
- name: 'gcr.io/${PROJECT_ID}/pack:${SHORT_SHA}'
args: ['trust-builder', 'gcf-cpp-builder:bionic', ]
args: ['config', 'trusted-builders', 'add', 'gcf-cpp-builder:bionic', ]
- name: 'gcr.io/${PROJECT_ID}/pack:${SHORT_SHA}'
args: ['set-default-builder', 'gcf-cpp-builder:bionic', ]
args: ['config', 'default-builder', 'gcf-cpp-builder:bionic', ]
id: 'gcf-builder-ready'

# Build the examples using the builder. Keep these in alphabetical order.
Expand Down
20 changes: 5 additions & 15 deletions ci/generate-build-examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,16 @@ options:
diskSizeGb: 512

steps:
# Create a docker image for the buildpacks `pack` tool
- name: 'gcr.io/cloud-builders/git'
args: [
'clone', '--depth=1',
'https://github.com/GoogleCloudPlatform/cloud-builders-community',
'third_party/cloud-builders-community',
]
waitFor: ['-']
id: 'clone-cloud-builders-community'
# Workaround a kaniko bug using the "edge" builder:
# https://github.com/GoogleContainerTools/kaniko/issues/1058
- name: 'gcr.io/kaniko-project/executor:edge'
args: [
"--context=dir:///workspace/third_party/cloud-builders-community/pack/",
"--dockerfile=Dockerfile",
"--context=dir:///workspace/build_scripts",
"--dockerfile=build_scripts/pack.Dockerfile",
"--destination=gcr.io/${PROJECT_ID}/pack:${SHORT_SHA}",
"--cache=true",
"--cache-ttl=48h"
]
waitFor: ['clone-cloud-builders-community']

# Create the docker images for the buildpacks builder.
- name: 'gcr.io/kaniko-project/executor:edge'
Expand Down Expand Up @@ -77,11 +67,11 @@ steps:

# Create the buildpacks builder, and make it the default.
- name: 'gcr.io/${PROJECT_ID}/pack:${SHORT_SHA}'
args: ['create-builder', 'gcf-cpp-builder:bionic', '--builder-config', 'pack/builder.toml', ]
args: ['builder', 'create', 'gcf-cpp-builder:bionic', '--config', 'pack/builder.toml', ]
- name: 'gcr.io/${PROJECT_ID}/pack:${SHORT_SHA}'
args: ['trust-builder', 'gcf-cpp-builder:bionic', ]
args: ['config', 'trusted-builders', 'add', 'gcf-cpp-builder:bionic', ]
- name: 'gcr.io/${PROJECT_ID}/pack:${SHORT_SHA}'
args: ['set-default-builder', 'gcf-cpp-builder:bionic', ]
args: ['config', 'default-builder', 'gcf-cpp-builder:bionic', ]
id: 'gcf-builder-ready'

# Build the examples using the builder. Keep these in alphabetical order.
Expand Down
6 changes: 3 additions & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ docker build -t gcf-cpp-runtime --target gcf-cpp-runtime -f build_scripts/Docker
We use [buildpacks](https://buildpacks.io) to compile the functions into runnable Docker images. First create a builder:

```sh
pack create-builder gcf-cpp-builder:bionic --config pack/builder.toml
pack trust-builder gcf-cpp-builder:bionic
pack builder create gcf-cpp-builder:bionic --config pack/builder.toml
pack config trusted-builders add gcf-cpp-builder:bionic
```

To avoid using the `--builder gcf-cpp-builder:bionic` option in each command we make this builder the default:

```sh
pack set-default-builder gcf-cpp-builder:bionic
pack config default-builder gcf-cpp-builder:bionic
```

## Creating a Docker image for the examples
Expand Down
12 changes: 7 additions & 5 deletions examples/site/howto_create_container/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ If needed, use the [online instructions][docker-install] to download and install
this tool. This guide assumes that you have configured [sudoless docker], if
you prefer replace all `docker` commands below with `sudo docker`.

Verify the [pack tool][pack-install] is functional on our workstation:
Verify the [pack tool][pack-install] is functional on our workstation. These
instructions were tested with v0.17.0, they should work with newer versions.
Some commands may not work with older versions.

```shell
pack version
# Output: a version number, e.g., 0.15.1+git-79adc30.build-1660
# Output: a version number, e.g., 0.17.0+git-d9cb4e7.build-2045
```

In this guide we will be using the [HTTP hello word][hello-world-http] function:
Expand Down Expand Up @@ -84,9 +86,9 @@ performance.
```sh
docker build -t gcf-cpp-develop -f build_scripts/Dockerfile .
docker build -t gcf-cpp-runtime --target gcf-cpp-runtime -f build_scripts/Dockerfile build_scripts
pack create-builder gcf-cpp-builder:bionic --config pack/builder.toml
pack trust-builder gcf-cpp-builder:bionic
pack set-default-builder gcf-cpp-builder:bionic
pack builder create gcf-cpp-builder:bionic --config pack/builder.toml
pack config trusted-builders add gcf-cpp-builder:bionic
pack config default-builder gcf-cpp-builder:bionic
```

## Building a Docker image
Expand Down
13 changes: 8 additions & 5 deletions examples/site/howto_deploy_cloud_event/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ If needed, use the [online instructions][docker-install] to download and install
this tool. This guide assumes that you have configured [sudoless docker], if
you prefer replace all `docker` commands below with `sudo docker`.

Verify the [pack tool][pack-install] is functional on our workstation:

Verify the [pack tool][pack-install] is functional on our workstation. These
instructions were tested with v0.17.0, they should work with newer versions.
Some commands may not work with older versions.

```shell
pack version
# Output: a version number, e.g., 0.15.1+git-79adc30.build-1660
# Output: a version number, e.g., 0.17.0+git-d9cb4e7.build-2045
```

In this guide we will be using the [Pub/Sub hello word][hello-world-pubsub] function:
Expand Down Expand Up @@ -84,9 +87,9 @@ performance.
```sh
docker build -t gcf-cpp-develop -f build_scripts/Dockerfile .
docker build -t gcf-cpp-runtime --target gcf-cpp-runtime -f build_scripts/Dockerfile build_scripts
pack create-builder gcf-cpp-builder:bionic --config pack/builder.toml
pack trust-builder gcf-cpp-builder:bionic
pack set-default-builder gcf-cpp-builder:bionic
pack builder create gcf-cpp-builder:bionic --config pack/builder.toml
pack config trusted-builders add gcf-cpp-builder:bionic
pack config default-builder gcf-cpp-builder:bionic
```

## Building a Docker image
Expand Down
13 changes: 8 additions & 5 deletions examples/site/howto_deploy_to_cloud_run/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ If needed, use the [online instructions][docker-install] to download and install
this tool. This guide assumes that you have configured [sudoless docker], if
you prefer replace all `docker` commands below with `sudo docker`.

Verify the [pack tool][pack-install] is functional on our workstation:

Verify the [pack tool][pack-install] is functional on our workstation. These
instructions were tested with v0.17.0, they should work with newer versions.
Some commands may not work with older versions.

```shell
pack version
# Output: a version number, e.g., 0.15.1+git-79adc30.build-1660
# Output: a version number, e.g., 0.17.0+git-d9cb4e7.build-2045
```

In this guide we will be using the [HTTP hello word][hello-world-http] function:
Expand Down Expand Up @@ -90,9 +93,9 @@ performance.
```sh
docker build -t gcf-cpp-develop -f build_scripts/Dockerfile .
docker build -t gcf-cpp-runtime --target gcf-cpp-runtime -f build_scripts/Dockerfile build_scripts
pack create-builder gcf-cpp-builder:bionic --config pack/builder.toml
pack trust-builder gcf-cpp-builder:bionic
pack set-default-builder gcf-cpp-builder:bionic
pack builder create gcf-cpp-builder:bionic --config pack/builder.toml
pack config trusted-builders add gcf-cpp-builder:bionic
pack config default-builder gcf-cpp-builder:bionic
```

## Building a Docker image
Expand Down