Skip to content

Commit

Permalink
Merge pull request #2 from amp-buildpacks/feat/issue-1
Browse files Browse the repository at this point in the history
issue(#1): Create builder for Move
  • Loading branch information
lispking authored Jan 28, 2024
2 parents e3f0546 + c7e2a9d commit d607e25
Show file tree
Hide file tree
Showing 8 changed files with 518 additions and 2 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/push-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Push Builder Image

# on:
# release:
# types:
# - published

on:
push:
tags:
- v[0-9]+.*

permissions:
contents: read
packages: write

jobs:
push:
name: Push
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Get pack version
id: pack-version
run: |
version=$(jq -r .pack "scripts/.util/tools.json")
echo "version=${version#v}" >> "$GITHUB_OUTPUT"
- name: Install Global Pack
uses: buildpacks/github-actions/setup-pack@main
with:
pack-version: ${{ steps.pack-version.outputs.version }}

- name: Create Builder Image
run: |
pack builder create builder --config builder.toml
- name: Set environment variable
run: echo "IMAGE_NAME=ghcr.io/${{ github.repository }}" >> $GITHUB_ENV

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}

- name: Push To ghcr.io
run: |
registry_uri="ghcr.io"
registry_repo="${{ github.repository }}"
version="${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}"
version=${version#v}
docker tag builder "${registry_uri}/${registry_repo}:latest"
docker tag builder "${registry_uri}/${registry_repo}:${version}"
docker push "${registry_uri}/${registry_repo}:latest"
docker push "${registry_uri}/${registry_repo}:${version}"
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) The Amphitheatre Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

bin/
dependencies/
package/
scratch/
53 changes: 51 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,51 @@
# move-builder
A Cloud Native Buildpacks (CNB) builder with Paketo stacks (Jammy Jellyfish) and Move buildpacks
# `ghcr.io/amp-buildpacks/move-builder`

A Cloud Native Buildpacks (CNB) builder with Paketo stacks (Jammy Jellyfish) and move-builder

## Usage

To create the builder, just run

```shell
pack builder create <published-to>/move-builder --config builder.toml
```

For example

```shell
pack builder create amp-buildpacks/move-builder --config builder.toml
```

You can then build an app with it using

```shell
pack build <image-name> --builder <published-to>/move-builder
```

## Contributing

If anything feels off, or if you feel that some functionality is missing, please
check out the [contributing
page](https://docs.amphitheatre.app/contributing/). There you will find
instructions for sharing your feedback, building the tool locally, and
submitting pull requests to the project.

## License

Copyright (c) The Amphitheatre Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

## Credits

Heavily inspired by https://github.com/paketo-buildpacks/builder-jammy-tiny
30 changes: 30 additions & 0 deletions builder.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (c) The Amphitheatre Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

description = "A Cloud Native Buildpacks (CNB) builder with Paketo stacks (Jammy Jellyfish) and move-builder"

[[buildpacks]]
id = "amp-buildpacks/move"
uri = "docker://ghcr.io/amp-buildpacks/move:0.1.0"

[[order]]

[[order.group]]
id = "amp-buildpacks/move"
version = "0.1.0"

[stack]
id = "io.buildpacks.stacks.jammy.tiny"
build-image = "docker.io/paketobuildpacks/build-jammy-tiny"
run-image = "docker.io/paketobuildpacks/run-jammy-tiny"
51 changes: 51 additions & 0 deletions scripts/.util/print.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash

set -eu
set -o pipefail

function util::print::title() {
local blue reset message
blue="\033[0;34m"
reset="\033[0;39m"
message="${1}"

echo -e "\n${blue}${message}${reset}" >&2
}

function util::print::info() {
local message
message="${1}"

echo -e "${message}" >&2
}

function util::print::error() {
local message red reset
message="${1}"
red="\033[0;31m"
reset="\033[0;39m"

echo -e "${red}${message}${reset}" >&2
exit 1
}

function util::print::success() {
local message green reset
message="${1}"
green="\033[0;32m"
reset="\033[0;39m"

echo -e "${green}${message}${reset}" >&2
exitcode="${2:-0}"
exit "${exitcode}"
}

function util::print::warn() {
local message yellow reset
message="${1}"
yellow="\033[0;33m"
reset="\033[0;39m"

echo -e "${yellow}${message}${reset}" >&2
exit 0
}
3 changes: 3 additions & 0 deletions scripts/.util/tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pack": "v0.32.1"
}
Loading

0 comments on commit d607e25

Please sign in to comment.