Skip to content

Commit 133ddec

Browse files
authored
Merge pull request #3166 from tejal29/update_buildpacks
[docs] update buildpacks tutorial to custom builder
2 parents ac1f035 + e1c10ea commit 133ddec

File tree

6 files changed

+44
-50
lines changed

6 files changed

+44
-50
lines changed

docs/content/en/docs/pipeline-stages/builders.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Skaffold has native support for several different tools for building images:
1515
- locally
1616
- on cloud with [Google Cloud Build](https://cloud.google.com/cloud-build/docs/)
1717
* [Bazel](https://bazel.build/) locally
18-
* Custom script locally
19-
* [CNCF Buildpacks]({{<relref "/docs/tutorials/buildpacks">}})
18+
* [Custom script locally]({{< relref "/docs/pipeline-stages/builders#custom-build-script-run-locally" >}})
19+
* CNCF Buildpacks [TODO #2904](https://github.com/GoogleContainerTools/skaffold/issues/2904)
2020

2121
The `build` section in the Skaffold configuration file, `skaffold.yaml`,
2222
controls how artifacts are built. To use a specific tool for building

docs/content/en/docs/tutorials/_index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ Take a look at our other guides
2424

2525
| Tutorials References |
2626
|----------|
27-
| [Custom Builder]({{< relref "/docs/tutorials/buildpacks" >}}) |
27+
| [Custom Build Script]({{< relref "/docs/tutorials/custom-builder" >}}) |
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
11
---
2-
title: "Building Artifacts with CNCF Buildpacks"
3-
linkTitle: "Buildpacks"
4-
weight: 110
2+
title: "Building Artifacts with a Custom Build Script"
3+
linkTitle: "Custom Build Script"
4+
weight: 100
55
---
66

7-
This page describes building Skaffold artifacts with [buildpacks](https://buildpacks.io/).
7+
This page describes building Skaffold artifacts using a custom build script, which builds images using [buildpacks](https://buildpacks.io/).
88
Buildpacks enable building language-based containers from source code, without the need for a Dockerfile.
99

1010
## Before you begin
1111
First, you will need to have Skaffold and a Kubernetes cluster set up.
1212
To learn more about how to set up Skaffold and a Kubernetes cluster, see the [quickstart docs]({{< relref "/docs/quickstart" >}}).
1313

14-
To use buildpacks with Skaffold, please install the following additional tools:
14+
For this tutorial, to use buildpacks as a custom builder with Skaffold, please install the following additional tools:
1515

1616
* [pack](https://buildpacks.io/docs/install-pack/)
1717
* [docker](https://docs.docker.com/install/)
1818

19-
## Tutorial - Hello World in Go
20-
21-
To walk through a buildpacks tutorial, see our [buildpacks example](https://github.com/GoogleContainerTools/skaffold/tree/master/examples/buildpacks).
22-
23-
24-
## Adding Buildpacks to Your Skaffold Project
2519

2620
To use buildpacks with your own project, you must choose a buildpack image to build your artifacts.
2721
To see a list of available buildpacks, run:
@@ -37,8 +31,15 @@ Set your default buildpack:
3731
$ pack set-default-builder <insert buildpack image here>
3832
```
3933

40-
Now, configure your Skaffold config to build artifacts with buildpacks.
41-
To do this, we will take advantage of the [custom builder](../builders) in Skaffold.
34+
## Tutorial - Hello World in Go
35+
36+
This tutorial will be based on the [buildpacks example](https://github.com/GoogleContainerTools/skaffold/tree/master/examples/buildpacks) in our repository.
37+
38+
39+
## Adding a Custom Builder to Your Skaffold Project
40+
41+
We'll need to configure your Skaffold config to build artifacts with this custom builder.
42+
To do this, we will take advantage of the [custom builder]({{<relref "docs/pipeline-stages/builders#custom-build-script-run-locally" >}}) in Skaffold.
4243

4344
First, add a `build.sh` file which Skaffold will call to build artifacts:
4445

@@ -50,10 +51,10 @@ Then, configure artifacts in your `skaffold.yaml` to build with `build.sh`:
5051
{{% readfile file="samples/builders/custom-buildpacks/skaffold.yaml" %}}
5152

5253
List the file dependencies for each artifact; in the example above, Skaffold watches all files in the build context.
53-
For more information about listing dependencies for custom artifacts, see the documentation [here](../builders).
54+
For more information about listing dependencies for custom artifacts, see the documentation [here]({{<relref "docs/pipeline-stages/builders#getting-dependencies-from-a-command" >}}).
5455

5556

56-
You can check buildpacks are properly configured by running `skaffold build`.
57+
You can check custom builder is properly configured by running `skaffold build`.
5758
This command should build the artifacts and exit successfully.
5859

5960

docs/content/en/samples/builders/build.sh

+9-14
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,12 @@ bazel build //:skaffold_example.tar
44
TAR_PATH=$(bazel info bazel-bin)
55
docker load -i $TAR_PATH/skaffold_example.tar
66

7-
8-
images=$(echo $IMAGES | tr " " "\n")
9-
10-
for image in $images
11-
do
12-
docker tag bazel:skaffold_example $image
13-
14-
if $PUSH_IMAGE
15-
then
16-
docker push $image
17-
fi
18-
19-
done
20-
7+
image=$(echo $IMAGE)
8+
9+
if [ ! -z "$image" ]; then
10+
pack build $image
11+
if $PUSH_IMAGE
12+
then
13+
docker push $image
14+
fi
15+
fi

examples/buildpacks/build.sh

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#!/bin/bash
22
set -e
3-
images=$(echo $IMAGES | tr " " "\n")
3+
image=$(echo $IMAGE)
44

5-
for image in $images
6-
do
7-
pack build $image
8-
if $PUSH_IMAGE
9-
then
10-
docker push $image
11-
fi
12-
done
5+
if [ ! -z "$image" ]; then
6+
pack build $image
7+
if $PUSH_IMAGE
8+
then
9+
docker push $image
10+
fi
11+
fi

integration/examples/custom/build.sh

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#!/bin/bash
22
set -e
3-
images=$(echo $IMAGES | tr " " "\n")
3+
image=$(echo $IMAGE)
44

5-
for image in $images
6-
do
7-
pack build $image
8-
if $PUSH_IMAGE
9-
then
10-
docker push $image
11-
fi
12-
done
5+
if [ ! -z "$image" ]; then
6+
pack build $image
7+
if $PUSH_IMAGE
8+
then
9+
docker push $image
10+
fi
11+
fi

0 commit comments

Comments
 (0)