-
Notifications
You must be signed in to change notification settings - Fork 153
Project for Dockerfiles proof of concept #113
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
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
badb2de
Initial skeleton of files
a756093
Update builder.toml
5712ae9
Changes to run with lifecycle poc
8acb189
Add order
73b1893
Update .gitignore
64ac5d3
wip
8120084
Update .gitignore
6b2775c
Add buildpack name
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,8 @@ | ||
| #!/bin/bash | ||
|
|
||
| echo "Running 'curl google.com' ......" | ||
| echo | ||
| echo | ||
| echo | ||
| echo | ||
| curl google.com |
This file contains hidden or 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 @@ | ||
| #!/bin/bash | ||
|
|
||
| exit 0 |
This file contains hidden or 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,9 @@ | ||
| api = "0.7" | ||
|
|
||
| [buildpack] | ||
| id = "samples/use_curl" | ||
| version = "0.0.1" | ||
| name = "Buildpack using curl" | ||
|
|
||
| [[stacks]] | ||
| id = "*" |
This file contains hidden or 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,36 @@ | ||
| #!/usr/bin/env bash | ||
| set -eo pipefail | ||
|
|
||
| # INPUT ARGUMENTS | ||
| platform_dir=$2 | ||
| env_dir=${platform_dir}/env | ||
| output_dir=$1 | ||
| plan_path=$3 | ||
|
|
||
| # Create Dockerfile | ||
| cat << EOF > ${output_dir}/Dockerfile | ||
| ARG base_image | ||
| FROM \${base_image} | ||
|
|
||
| ARG some_arg | ||
| RUN echo \${some_arg} > /opt/arg.txt | ||
|
|
||
| ARG build_id=0 | ||
| RUN echo \${build_id} | ||
|
|
||
| RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* | ||
| EOF | ||
|
|
||
| # Create build.toml | ||
| cat << EOF > ${output_dir}/build.toml | ||
| [[args]] | ||
| name = "some_arg" | ||
| value = "some-arg-build-value" | ||
| EOF | ||
|
|
||
| # Create launch.toml | ||
| cat << EOF > ${output_dir}/launch.toml | ||
| [[args]] | ||
| name = "some_arg" | ||
| value = "some-arg-launch-value" | ||
| EOF |
This file contains hidden or 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,5 @@ | ||
| #!/usr/bin/env bash | ||
| set -eo pipefail | ||
|
|
||
| # Always detect | ||
| exit 0 |
This file contains hidden or 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,8 @@ | ||
| api = "0.7" | ||
|
|
||
| [extension] | ||
| id = "samples/curl" | ||
| name = "Curl Extension" | ||
| version = "0.0.1" | ||
| homepage = "https://github.com/buildpacks/samples/tree/main/extensions/curl" | ||
| description = "This extension always installs the latest version of curl." |
This file contains hidden or 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,9 @@ | ||
| ARG base_image | ||
| FROM ${base_image} | ||
| ARG build_id=0 | ||
|
|
||
| LABEL io.buildpacks.rebasable=true | ||
|
|
||
| # TODO: replace with real package | ||
| RUN echo | ||
| # RUN curl -L https://example.com/mypkg-install | sh # installs to /opt |
This file contains hidden or 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,8 @@ | ||
| api = "0.7" | ||
|
|
||
| [extension] | ||
| id = "samples/rebasable" | ||
| name = "Rebasable Extension" | ||
| version = "0.0.1" | ||
| homepage = "https://github.com/buildpacks/samples/tree/main/extensions/rebasable" | ||
| description = "This extension is rebasable because it creates a single directory under /opt." |
This file contains hidden or 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,36 @@ | ||
| #!/usr/bin/env bash | ||
| set -eo pipefail | ||
|
|
||
| # INPUT ARGUMENTS | ||
| platform_dir=$2 | ||
| env_dir=${platform_dir}/env | ||
| output_dir=$1 | ||
| plan_path=$3 | ||
|
|
||
| # Create Dockerfile | ||
| cat << EOF > ${output_dir}/Dockerfile | ||
| ARG base_image | ||
| FROM \${base_image} | ||
|
|
||
| ARG some_arg | ||
| RUN echo \${some_arg} > /opt/arg.txt | ||
|
|
||
| ARG build_id=0 | ||
| RUN echo \${build_id} | ||
|
|
||
| RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* | ||
| EOF | ||
|
|
||
| # Create build.toml | ||
| cat << EOF > ${output_dir}/build.toml | ||
| [[args]] | ||
| name = "some_arg" | ||
| value = "some-arg-build-value" | ||
| EOF | ||
|
|
||
| # Create launch.toml | ||
| cat << EOF > ${output_dir}/launch.toml | ||
| [[args]] | ||
| name = "some_arg" | ||
| value = "some-arg-launch-value" | ||
| EOF |
This file contains hidden or 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,5 @@ | ||
| #!/usr/bin/env bash | ||
| set -eo pipefail | ||
|
|
||
| # Always detect | ||
| exit 0 |
This file contains hidden or 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,8 @@ | ||
| api = "0.7" | ||
|
|
||
| [extension] | ||
| id = "samples/curl" | ||
| name = "Curl Extension" | ||
| version = "0.0.1" | ||
| homepage = "https://github.com/buildpacks/samples/tree/main/extensions/curl" | ||
| description = "This extension always installs the latest version of curl." |
This file contains hidden or 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,8 @@ | ||
| ARG base_image | ||
| FROM ${base_image} | ||
| ARG build_id=0 | ||
|
|
||
| LABEL io.buildpacks.rebasable=true | ||
|
|
||
| # TODO: replace with real package | ||
| RUN curl -L https://example.com/mypkg-install | sh # installs to /opt |
This file contains hidden or 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,8 @@ | ||
| api = "0.7" | ||
|
|
||
| [extension] | ||
| id = "samples/rebasable" | ||
| name = "Rebasable Extension" | ||
| version = "0.0.1" | ||
| homepage = "https://github.com/buildpacks/samples/tree/main/extensions/rebasable" | ||
| description = "This extension is rebasable because it creates a single directory under /opt." |
Empty file.
This file contains hidden or 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 @@ | ||
| [[order]] | ||
| [[order.group]] | ||
| id = "samples/curl" | ||
| version = "0.0.1" | ||
| extension = true | ||
| optional = true | ||
|
|
||
| [[order.group]] | ||
| id = "samples/rebasable" | ||
| version = "0.0.1" | ||
| extension = true | ||
| optional = true | ||
|
|
||
| [[order.group]] | ||
| id = "samples/use_curl" | ||
| version = "0.0.1" | ||
| extension = false | ||
| optional = false |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the extensions uri is part of the
[[buildpacks]]block, how thebuildertool will be able to package within the image, the buildpacks containing thebin/detect, bin/buildvs extensions as the existing uri parameter is used to fetch buildpacks content only ?Why don't we package the extensions part of a separate block
[[extensions]].Why such a proposition:
*: If the buildpack detects that a tool, package is needed (curl, maven, java, ...), then it can report (
maven 3.xis needed), then theextensionphase-step could then be called to install the corresponding tool/command (e.g curl, java, maven, ... ) for the suggested version before thebuildphase is called.REMARK: That implies that an extension is designed as a kind of module to install according to the name of the extension, what the name refers instead of zillions of packages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strongly agree -- let's add a separate
[[extensions]]table.Also, can we do the same with
[[order]]and create a separate[[order-ext]]table?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we need such an order table but how will it be possible to it them easily as ideally the extensions should be independent.
Will the builder be able to understand that java should be installed before maven, that curl should be the first ....
Instead of defining a specific order I would prefer to delegate to the
detectphase of the buikldpack the responsibility to report to theextensionphase (= optional step taking place before the build phase if extensions exist) what it is needed and required.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Submitted a PR for this change: #115.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is an interesting question about the order. My understanding is from the RFC is that extensions should always come first in the order. The separate
[[order-ext]]table is a bit confusing to me, as what would happen if multiple groups are defined there? This would change the lifecycle implementation (detectwould happen separately for extensions vs. buildpacks).