Skip to content

Commit

Permalink
Restructure App Developer Guide
Browse files Browse the repository at this point in the history
Use the structure described in RFC # and add some tests

Signed-off-by: Aidan Delaney <[email protected]>
  • Loading branch information
AidanDelaney committed Dec 6, 2023
1 parent f1800f9 commit 8641321
Show file tree
Hide file tree
Showing 50 changed files with 78 additions and 25 deletions.
4 changes: 2 additions & 2 deletions content/docs/app-developer-guide/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title="App Developer Guide"
weight=4
title="For App Developers"
weight=1
include_summaries=true
expand=true
+++
Expand Down
61 changes: 55 additions & 6 deletions content/docs/app-developer-guide/build-an-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,32 @@ aliases=[
# Build an app
`+-->

<!-- test:suite=create-app;weight=1 -->

<!-- test:setup:exec;exit-code=-1 -->
<!--
```bash
docker rmi sample-app
pack config trusted-builders add cnbs/sample-builder:jammy
```
-->

<!-- test:teardown:exec -->
<!--
```bash
docker rmi sample-app
```
-->

Building an app using Cloud Native Buildpacks is as easy as `1`, `2`, `3`...

## Prerequisites

A lot of the examples used within this guide will require the following:

{{< download-button href="https://store.docker.com/search?type=edition&offering=community" color="blue" >}} Install Docker {{</>}}
{{< download-button href="/docs/install-pack" color="pink" >}} Install pack {{</>}}

### 1. Select a builder

To [build][build] an app you must first decide which [builder][builder] you're going to use. A builder
Expand All @@ -28,18 +52,22 @@ pack builder suggest
For this guide we're actually going to use a sample builder, `cnbs/sample-builder:jammy`, which is not listed
as a suggested builder for good reason. It's a sample.

> **TIP:** If you want to try production grade buildpacks, instead of our sample, use the `paketobuildpacks/builder:full` builder. Alternatively, if you intend to deploy your application on Google Cloud Run, use try the `Google` builder. If your intended platform is Heroku, use the `Heroku` builder.
### 2. Build your app

Now that you've decided on what builder to use, we can build our app. For this example we'll use our [samples][samples]
repo for simplicity.

1. Check that the samples repo exists and if not - we clone it
<!-- test:exec -->
```
ls samples || git clone https://github.com/buildpacks/samples
```
<!--+- "{{execute}}"+-->

2. Build the app
<!-- test:exec -->
```
pack build sample-app --path samples/apps/java-maven --builder cnbs/sample-builder:jammy
```
Expand All @@ -51,8 +79,11 @@ pack build sample-app --path samples/apps/java-maven --builder cnbs/sample-build
### 3. Run it

Here we `--name` the running container so that we can clean up after it:

<!-- test:exec -->
```
docker run --rm -p 8080:8080 sample-app
docker run --rm -p 8080:8080 --name sample-app sample-app
```
<!--+- "{{execute}}"+-->

Expand All @@ -62,18 +93,36 @@ docker run --rm -p 8080:8080 sample-app
The app should now be running and accessible via [localhost:8080](http://localhost:8080).
<!--+end+-->

<!--+ `
Now open your favorite browser and point it to port "8080" of your host and take a minute to enjoy the view.

On Katacoda you can do this by [clicking here](https://[[HOST_SUBDOMAIN]]-8080-[[KATACODA_HOST]].environments.katacoda.com)
` +-->
### 4. Verify it

Executing

<!-- test:exec -->
```
curl http://localhost:8080
```

should contain the `<title>`
<!-- test:assert=contains -->
```text
Buildpacks.io Java Sample
```

### 5. Clean it up

<!-- test:exec -->
```
docker kill sample-app
```

## What about ARM apps?

Linux ARM image builds are now supported!

<!--+- if false+-->
<a href="/docs/app-developer-guide/build-an-arm-app" class="button bg-blue">Linux ARM build guide</a>
<a href="/docs/app-developer-guide/how-to/build-an-arm-app" class="button bg-blue">Linux ARM build guide</a>
<!--+end+-->

<!--+ `
Expand All @@ -84,7 +133,7 @@ Check out the [Linux ARM build guide](https://buildpacks.io//docs/app-developer-
Windows image builds are now supported!

<!--+- if false+-->
<a href="/docs/app-developer-guide/build-a-windows-app" class="button bg-blue">Windows build guide</a>
<a href="/docs/app-developer-guide/how-to/build-a-windows-app" class="button bg-blue">Windows build guide</a>
<!--+end+-->
<!--+ `
Check out the [Windows build guide](https://buildpacks.io/docs/app-developer-guide/build-a-windows-app/).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title="Concepts"
weight=3
weight=1000
expand=false
+++

Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
5 changes: 5 additions & 0 deletions content/docs/app-developer-guide/how-to/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
+++
title="How To"
weight=100
summary="Short focused guides to performing a specific task"
+++
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title="Building on Podman"
weight=99
title="(Advanced) Building on Podman"
weight=20
summary="Use podman as an alternative to Docker with Cloud Native Buildpacks."
aliases=[
"/docs/using-pack/building-app/"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title="Environment variables"
weight=3
weight=2
summary="Environment variables are a common way to configure various buildpacks at build-time."
+++
<!--+- `
Expand Down
5 changes: 5 additions & 0 deletions content/docs/app-developer-guide/tutorials/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
+++
title="Tutorials"
weight=200
summary="Introductory articles that describe details"
+++
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title="Build a Windows app"
weight=2
title="(Advanced) Build a Windows app"
weight=20
summary="The basics of taking your Windows app from source code to runnable image."
+++

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title="Build an ARM app"
weight=2
title="(Advanced) Build an ARM app"
weight=20
summary="The basics of taking your app from source code to runnable ARM image."
+++

Expand Down
2 changes: 1 addition & 1 deletion content/docs/buildpack-author-guide/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
+++
title="Buildpack Author Guide"
title="For Buildpack Authors"
weight=4
include_summaries=true
expand=true
Expand Down
6 changes: 0 additions & 6 deletions content/docs/operator-guide/_index.md

This file was deleted.

4 changes: 2 additions & 2 deletions content/docs/platform-guide/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title="Platform Guide"
weight=6
title="For Platform Operators"
weight=3
include_summaries=true
expand=true
+++

0 comments on commit 8641321

Please sign in to comment.