Skip to content

Commit 68ff102

Browse files
authored
Merge branch 'main' into polish/407
2 parents 7a47a9e + a71e557 commit 68ff102

34 files changed

+702
-332
lines changed

.github/bug_report.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
### **Describe the bug**
2+
A clear and concise description of what the bug is.
3+
4+
### **To Reproduce**
5+
Steps to reproduce the behavior:
6+
1. Go to '...'
7+
2. Click on '....'
8+
3. Scroll down to '....'
9+
4. See error
10+
11+
### **Expected behavior**
12+
A clear and concise description of what you expected to happen.
13+
14+
### **Screenshots**
15+
If applicable, add screenshots or screen captures to help explain your problem.
16+
17+
### **Additional context**
18+
Add any other context about the problem here.
19+
20+
<hr/>
21+
22+
<!--- Do not remove or change this in the issue description. Only update the details above this. --->
23+
**Note:**
24+
* If you want to work on an issue, you should check if it has already been assigned to anyone. **If the issue is free** and you would like to be assigned to it please comment on the issue.
25+
* If you are raising a new issue and want to work on it then also you should comment to get assigned.
26+
* Please **refrain from** adding labels to your issue/pull-request on your own. It is the job of the Project Admin and the Mentors to review your issue/pull-request and add labels accordingly.
27+

.github/workflows/main.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Git Checkout
1919
uses: actions/checkout@v2
2020
- name: Setup Go environment
21-
uses: actions/[email protected].3
21+
uses: actions/[email protected].4
2222
with:
2323
go-version: '1.x'
2424
- name: Install Dependencies
@@ -35,7 +35,7 @@ jobs:
3535
run: |
3636
make check-links
3737
- name: Upload public folder
38-
uses: actions/upload-artifact@v1
38+
uses: actions/upload-artifact@v2.2.4
3939
env:
4040
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4141
with:
@@ -48,13 +48,14 @@ jobs:
4848
runs-on: ubuntu-latest
4949
steps:
5050
- name: Download public folder
51-
uses: actions/download-artifact@v1
51+
uses: actions/download-artifact@v2.0.10
5252
with:
5353
name: public
54+
path: ./public
5455
- name: Deploy
5556
uses: peaceiris/actions-gh-pages@v3
5657
with:
5758
github_token: ${{ secrets.GITHUB_TOKEN }}
5859
publish_dir: ./public
5960
cname: buildpacks.io
60-
full_commit_message: ${{ github.event.head_commit.message }}
61+
full_commit_message: ${{ github.event.head_commit.message }}

content/docs/app-developer-guide/build-a-windows-app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ summary="The basics of taking your Windows app from source code to runnable imag
66

77
> **EXPERIMENTAL:**
88
>
9-
> - Please note that **Windows container support is currently experimental**. You may be asked to enable experimental features in `pack` when running the following commands. Simply follow the on-screen instructions to do so.
9+
> - Please note that **Windows container support is currently experimental**. You may be asked to enable experimental features in `pack` when running the following commands. Simply follow the on-screen instructions to do so.
1010
> - If you encounter any problems while experimenting, we'd love for you to let us know by filing an issue on the [pack][pack-issues] or [lifecycle][lifecycle-issues] repo.
1111
1212
### Recommended reading

content/docs/app-developer-guide/build-an-app.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ docker run --rm -p 8080:8080 sample-app
5555

5656
The app should now be running and accessible via [localhost:8080](http://localhost:8080).
5757

58+
## What about ARM apps?
59+
60+
Linux ARM image builds are now supported!
61+
62+
<a href="/docs/app-developer-guide/build-an-arm-app" class="button bg-blue">Linux ARM build guide</a>
63+
5864
## What about Windows apps?
5965

6066
Windows image builds are now supported!
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
+++
2+
title="Build an ARM app"
3+
weight=2
4+
summary="The basics of taking your app from source code to runnable ARM image."
5+
+++
6+
7+
As of today, there are no CNB platforms (e.g. [pack][pack]) that support building ARM application images. In the following tutorial, we will be performing a build "manually", in that we will be performing a build by invoking the lifecycle directly.
8+
9+
### 1. Prepare your working directory
10+
11+
On your Linux ARM machine with a [docker][docker] daemon installed, prepare the following directory tree structure.
12+
13+
```bash
14+
tree ~/workspace/
15+
~/workspace/
16+
├── buildpacks
17+
│ └── samples_hello-world
18+
└── platform
19+
```
20+
21+
In addition, clone the [samples][samples] repository which will contain the application source code.
22+
23+
```bash
24+
# clone the repo
25+
git clone https://github.com/buildpacks/samples ~/workspace/samples
26+
```
27+
28+
### 2. Prepare the assets
29+
30+
Now we need to prepare assets that will be used during the build process.
31+
32+
First we download and extract the [lifecycle][lifecycle] release, compiled for ARM. Make sure to replace `<RELEASE-VERSION>` with a valid release version.
33+
34+
```bash
35+
# change to destination directory
36+
cd ~/workspace
37+
38+
# download and extract lifecycle
39+
curl -L https://github.com/buildpacks/lifecycle/releases/download/v<RELEASE-VERSION>/lifecycle-v<RELEASE-VERSION>+linux.arm64.tgz | tar xf -
40+
```
41+
42+
Next we make sure that our buildpack directory is structured in a way that the lifecycle will expect.
43+
44+
```bash
45+
# copy hello-world buildpack
46+
cp -R ~/workspace/samples/buildpacks/hello-world ~/workspace/buildpacks/samples_hello-world/0.0.1
47+
```
48+
49+
And finally we write the `order.toml` file that references the hello-world buildpack.
50+
51+
```bash
52+
cat > ~/workspace/order.toml <EOF
53+
[[order]]
54+
[[order.group]]
55+
id = "samples/hello-world"
56+
version = "0.0.1"
57+
optional = false
58+
EOF
59+
```
60+
61+
### 3. Build your app
62+
63+
Now we can build our app. For this example we will be using the docker CLI to invoke the lifecycle directly.
64+
65+
```bash
66+
# invoke the lifecycle
67+
docker run --rm \
68+
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
69+
--volume ~/workspace/lifecycle:/cnb/lifecycle \
70+
--volume ~/workspace/buildpacks:/cnb/buildpacks \
71+
--volume ~/workspace/samples/apps/bash-script:/workspace \
72+
--volume ~/workspace/platform:/platform \
73+
--mount type=bind,source=~/workspace/order.toml,target=/cnb/order.toml \
74+
--env CNB_PLATFORM_API=0.7 \
75+
ubuntu:bionic \
76+
/cnb/lifecycle/creator -log-level debug -daemon -run-image ubuntu:bionic hello-arm64
77+
```
78+
79+
### 4. Run it
80+
81+
```bash
82+
docker run --rm hello-arm64
83+
```
84+
85+
**Congratulations!**
86+
87+
The app image should now be built and stored on the docker daemon. You may perform `docker images` to verify.
88+
89+
[pack]: https://github.com/buildpacks/pack
90+
[docker]: https://docs.docker.com
91+
[samples]: https://github.com/buildpacks/samples
92+
[lifecycle]: https://github.com/buildpacks/lifecycle

content/docs/app-developer-guide/environment-variables.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ The following environment variables were set and available to buildpacks at buil
8787
8888
### Using Project Descriptor
8989
The `--descriptor` parameter must be a path to a file which follows the project.toml [schema][descriptor-schema].
90+
Without the `--descriptor` flag, `pack build` will use the `project.toml` file in the application directory if it exists.
9091
You can define environment variables in an `env` table in the file, and pass those into the application.
9192

9293
##### Example:
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
+++
2+
title="Using Buildpacks with a Proxy"
3+
weight=8
4+
summary="Learn how to use buildpacks behind a HTTP proxy."
5+
+++
6+
7+
Many university or corporate environments use a proxy to access HTTP and HTTPS resources on the web. Proxies introduce two constraints on buildpack built applications:
8+
9+
1. `pack` needs to download buildpacks through the proxies, and
10+
2. applications running in containers created by `pack` need to call APIs behind the proxy.
11+
12+
We show how to solve both of these constraints.
13+
14+
## Making `pack` Proxy Aware
15+
16+
You may need the `pack` command-line tool to download buildpacks and images via your proxy. Building an application with an incorrectly configured proxy results in errors such as the following:
17+
18+
```console
19+
$ pack build sample-app --path samples/apps/java-maven --builder cnbs/sample-builder:bionic
20+
ERROR: failed to build: failed to fetch builder image 'index.docker.io/cnbs/sample-builder:bionic'
21+
: Error response from daemon: Get "https//registry-1.docker.io/v2/": context deadline exceeded
22+
```
23+
24+
The `pack` tool uses the Docker daemon to manage the local image registry on your machine. The `pack` tool will ask the Docker daemon to download buildpacks and images for you. Because of this relationship, between `pack` and the Docker daemon, we need to configure the Docker daemon to use a HTTP proxy. The approach to setting the HTTP proxy depends on your platform:
25+
26+
27+
### Docker Desktop (Windows and MacOS)
28+
Docker's documetation states "Docker Desktop lets you configure HTTP/HTTPS Proxy Settings and automatically propagates these to Docker". Set the system proxy using the [MacOS documentation](https://support.apple.com/en-gb/guide/mac-help/mchlp2591/mac) or [Windows documentation](https://www.dummies.com/computers/operating-systems/windows-10/how-to-set-up-a-proxy-in-windows-10/). The system proxy settings will be used by Docker Desktop.
29+
30+
### Linux
31+
The Docker project documents [how to configure configure the HTTP/HTTPS proxy](https://docs.docker.com/config/daemon/systemd/#httphttps-proxy) settings for the Docker daemon on Linux. You should configure the `HTTP_PROXY` and `HTTPS_PROXY` environment variables as part of the Docker daemon startup.
32+
33+
## Proxy Settings for Buildpacks
34+
35+
Buildpacks may also need to be aware of your http and https proxies at build time. For example python, java and nodejs buildpacks need to be aware of proxies in order to resolve dependencies. To make buildpacks aware of proxies, export the `http_proxy` and `https_proxy` environment variables before invoking `pack`. For example:
36+
37+
```console
38+
export http_proxy=http://user:[email protected]:3128
39+
export https_proxy=https://my-proxy.example.com:3129
40+
pack build sample-app --path samples/apps/java-maven --builder cnbs/sample-builder:bionic
41+
```
42+
43+
## Making your Application Proxy Aware
44+
45+
Your application may need to use http or https proxies to access web-based APIs. In order to make proxy settings available inside containers you should edit your `~/.docker/config.json` file (`%USERPROFILE%\.docker\config.json` on Windows) to contain the proxy information. The `httpProxy`, `httpsProxy` and `noProxy` properties of this configuration file are injected into containers at build time and at run time as the `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY` environment variables respectively. Both the http and https proxy settings are also injected in their lower-case form as `http_proxy` and `https_proxy`.
46+
47+
```json
48+
{
49+
"proxies": {
50+
"default": {
51+
"httpProxy": "http://user:[email protected]:3128",
52+
"httpsProxy": "https://my-proxy.example.com:3129",
53+
"noProxy": "internal.mycorp.example.com"
54+
}
55+
}
56+
}
57+
```
58+
59+
If your application requires a http or https proxy, then you should prefer to read proxy information from the lower-case `http_proxy` and `https_proxy` variables.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
+++
2+
title="Using Inline Buildpacks"
3+
weight=7
4+
summary="Learn how to create an ephemeral buildpack to customize your build."
5+
+++
6+
7+
You can supplement your app's build proces with custom scripts by creating an _inline buildpack_. An inline buildpack is an ephemeral buildpack that's defined in your [project descriptor][project-toml] (i.e. `project.toml`). You can include a script to run as part of the build without setting up all the files and directories that are required for a complete buildpack.
8+
9+
Inline buildpacks are defined as an entry in the `[[build.buildpacks]]` table of the project descriptor by inlcuding an `inline` script in the `[build.buildpacks.script]` table.
10+
11+
For example, you may want to run a Rake task against a Ruby app after the Ruby buildpack builds your app.
12+
13+
```toml
14+
[project]
15+
id = "io.buildpacks.my-app"
16+
17+
[[build.buildpacks]]
18+
id = "example/ruby"
19+
version = "1.0"
20+
21+
[[build.buildpacks]]
22+
id = "me/rake-tasks"
23+
24+
[build.buildpacks.script]
25+
api = "0.6"
26+
inline = "rake package"
27+
```
28+
29+
In this example, the `me/rake-tasks` inline buildpack is configured to run after the `example/ruby` buildpack. The inline script is compatible with API version `0.4` (this is a required field), and it will execute the `rake package` command during the build step.
30+
31+
> **Note:** Inline buildpacks will _always_ pass detection.
32+
33+
Inline buildpacks aren't constrained to a single command, however. You can define complex scripts as [heredocs](https://toml.io/en/v1.0.0#string) in your project descriptor. For example, this snippet of a descriptor will source a shell script contained in the app repo, use it to modify the app directory (and thus the files that go into the final image), and create slices for the app:
34+
35+
```toml
36+
[[build.buildpacks]]
37+
id = "me/cleanup"
38+
39+
[build.buildpacks.script]
40+
api = "0.6"
41+
inline = """
42+
set -e
43+
source scripts/utils.sh
44+
find . -type f -name $(my_data_files) -delete
45+
cat <<EOF > ${1}/launch.toml
46+
[[processes]]
47+
type = 'bash'
48+
command = 'bin/bash'
49+
EOF
50+
"""
51+
```
52+
53+
### Further Reading
54+
For more about project descriptors, look at the [schema][descriptor-schema], as well as the [specification][spec].
55+
56+
[project-toml]: /docs/app-developer-guide/using-project-descriptor/
57+
[descriptor-schema]: /docs/reference/project-descriptor/
58+
[spec]: https://github.com/buildpacks/spec/blob/main/extensions/project-descriptor.md

content/docs/buildpack-author-guide/create-buildpack/building-blocks-cnb.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Let's create the directory where your buildpack will live:
1111

1212
## Using the Pack CLI
1313

14-
The `buildpack new <id>` commmand will create a directory named for the buildpack ID.
14+
The `buildpack new <id>` command will create a directory named for the buildpack ID.
1515

1616
Example:
1717
<!-- test:exec -->

content/docs/buildpack-author-guide/create-buildpack/detection.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ weight=403
55

66
<!-- test:suite=create-buildpack;weight=3 -->
77

8-
Next, you will want to actually detect that the app your are building is a Ruby app. In order to do this, you will need to check for a `Gemfile`.
8+
Next, you will want to actually detect that the app you are building is a Ruby app. In order to do this, you will need to check for a `Gemfile`.
99

1010
Replace `exit 1` in the `detect` script with the following check:
1111

@@ -50,7 +50,7 @@ You should see the following output:
5050

5151
Notice that `detect` now passes because there is a valid `Gemfile` in the Ruby app at `ruby-sample-app`, but now `build` fails because it is currently written to error out.
5252

53-
You will also notice that `ANALYZING` now appears in the build output. This steps is part of the buildpack lifecycle that looks to see if any previous image builds have layers that the buildpack can re-use. We will get into this topic in more detail later.
53+
You will also notice that `ANALYZING` now appears in the build output. This step is part of the buildpack lifecycle that looks to see if any previous image builds have layers that the buildpack can re-use. We will get into this topic in more detail later.
5454

5555
---
5656

0 commit comments

Comments
 (0)