forked from GoogleCloudPlatform/cloud-builders-community
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Cloud Native Buildpacks pack CLI
Signed-off-by: David Gageot <[email protected]>
- Loading branch information
Showing
6 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM busybox | ||
ENV PACK_VERSION=v0.4.1 | ||
RUN wget -O- https://github.com/buildpack/pack/releases/download/${PACK_VERSION}/pack-${PACK_VERSION}-linux.tgz | tar zx | ||
|
||
FROM gcr.io/distroless/base | ||
ENTRYPOINT ["/pack"] | ||
COPY --from=0 /pack / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Pack | ||
|
||
[pack](https://github.com/buildpack/pack) is the CLI for building apps using [Cloud Native Buildpacks](https://buildpacks.io). | ||
|
||
This build step invokes `pack` commands in [Google Cloud Build](cloud.google.com/cloud-build/). | ||
|
||
Arguments passed to this builder will be passed to `pack` directly, allowing | ||
callers to run [any pack | ||
command](https://buildpacks.io/docs/using-pack/). | ||
|
||
## Usage: | ||
|
||
To build a Docker image from sources: | ||
|
||
``` | ||
steps: | ||
- name: gcr.io/$PROJECT_ID/pack | ||
args: ["build", "--builder", "heroku/buildpacks:18", "gcr.io/$PROJECT_ID/sample:tag"] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# In this directory, run the following command to build this builder. | ||
# $ gcloud builds submit . --config=cloudbuild.yaml | ||
|
||
steps: | ||
- name: 'gcr.io/cloud-builders/docker' | ||
args: ['build', '--tag=gcr.io/${PROJECT_ID}/pack', '.'] | ||
- name: 'gcr.io/${PROJECT_ID}/pack' | ||
args: ['--help'] | ||
|
||
images: ['gcr.io/${PROJECT_ID}/pack'] | ||
tags: ['cloud-builders-community'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
steps: | ||
- name: 'gcr.io/$PROJECT_ID/pack' | ||
args: | ||
- build | ||
- --builder | ||
- heroku/buildpacks:18 | ||
- gcr.io/$PROJECT_ID/pack-sample | ||
|
||
images: | ||
- gcr.io/$PROJECT_ID/pack-sample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/GoogleCloudPlatform/cloud-builders-community/pack/sample | ||
|
||
go 1.13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"net/http" | ||
) | ||
|
||
func main() { | ||
http.HandleFunc("/", hello) | ||
|
||
log.Println("Listening on port 8080") | ||
http.ListenAndServe(":8080", nil) | ||
} | ||
|
||
func hello(w http.ResponseWriter, r *http.Request) { | ||
fmt.Fprintf(w, "Hello, World!") | ||
} |