🚀 Publish Image Builder #61
Workflow file for this run
This file contains 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
name: 🚀 Publish Image Builder | |
on: | |
push: | |
tags: | |
- 'image-builder-v*' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🛑 Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.9.1 | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.0 | |
- name: ⬇️ Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 5 | |
- name: Version | |
id: version | |
run: | | |
if [[ $GITHUB_REF == refs/tags/* ]] | |
then | |
tag=${GITHUB_REF##refs/tags/} | |
v=${tag##image-builder-} | |
echo "::set-output name=version::$v" | |
else | |
echo "::set-output name=version::$GITHUB_SHA" | |
fi | |
- name: Dist | |
run: make dist-image-builder | |
env: | |
VERSION: ${{ steps.version.outputs.version }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.PAT }} # `PAT` is a secret that contains your Personal Access Token with `write:packages` scope | |
- name: Build buildpack base image | |
uses: docker/build-push-action@v3.2.0 | |
with: | |
context: docker/image-builder/stacks/jammy/base | |
file: docker/image-builder/stacks/jammy/base/Dockerfile | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
tags: ghcr.io/gimlet-io/jammy-base:${{ steps.version.outputs.version }} | |
- name: Build buildpack build image | |
uses: docker/build-push-action@v3.2.0 | |
with: | |
context: docker/image-builder/stacks/jammy/jammy-build | |
file: docker/image-builder/stacks/jammy/jammy-build/Dockerfile | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
build-args: | | |
"base_image=ghcr.io/gimlet-io/jammy-base:${{ steps.version.outputs.version }}" | |
"stack_id=io.buildpacks.stacks.jammy" | |
tags: ghcr.io/gimlet-io/jammy-build:${{ steps.version.outputs.version }} | |
- name: Build buildpack run image | |
uses: docker/build-push-action@v3.2.0 | |
with: | |
context: docker/image-builder/stacks/jammy/run | |
file: docker/image-builder/stacks/jammy/run/Dockerfile | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
build-args: | | |
"base_image=ghcr.io/gimlet-io/jammy-base:${{ steps.version.outputs.version }}" | |
"stack_id=io.buildpacks.stacks.jammy" | |
tags: ghcr.io/gimlet-io/jammy-run:${{ steps.version.outputs.version }} | |
- name: Prep ARM64 buildpack | |
run: | | |
mkdir buildpacks | |
git clone https://github.com/gimlet-io/node-engine.git buildpacks/paketo-buildpacks_node-engine/ | |
cd buildpacks/paketo-buildpacks_node-engine/ | |
git reset --hard 7038a75c2378d653f1f14528267d0ca6565b4fc7 | |
./scripts/build.sh | |
cd .. && cd .. | |
git clone https://github.com/paketo-buildpacks/npm-start.git buildpacks/paketo-buildpacks_npm-start/ | |
cd buildpacks/paketo-buildpacks_npm-start/ | |
git reset --hard v1.0.11 | |
sed -i 's/GOOS=linux/GOOS=linux GOARCH=arm64/g' scripts/build.sh | |
sed -i 's/GOOS=\"linux\"/GOOS=linux GOARCH=arm64/g' scripts/build.sh | |
./scripts/build.sh | |
cd .. && cd .. | |
git clone https://github.com/paketo-buildpacks/npm-install.git buildpacks/paketo-buildpacks_npm-install/ | |
cd buildpacks/paketo-buildpacks_npm-install/ | |
git reset --hard v1.1.4 | |
sed -i 's/GOOS=linux/GOOS=linux GOARCH=arm64/g' scripts/build.sh | |
sed -i 's/GOOS=\"linux\"/GOOS=linux GOARCH=arm64/g' scripts/build.sh | |
./scripts/build.sh | |
cd .. && cd .. | |
export RELEASE_VERSION=v0.16.5 | |
curl -L https://github.com/buildpacks/lifecycle/releases/download/$RELEASE_VERSION/lifecycle-$RELEASE_VERSION+linux.arm64.tgz | tar xfz - | |
- name: Docker manifest create | |
id: manifest | |
run: | | |
echo $password | docker login ghcr.io -u gimlet-io --password-stdin | |
docker build \ | |
--platform linux/arm64/v8 \ | |
-f docker/image-builder/Dockerfile.arm64 \ | |
-t ghcr.io/gimlet-io/image-builder:arm64-${{ steps.version.outputs.version }} \ | |
--build-arg version=${{ steps.version.outputs.version }} \ | |
. | |
docker push ghcr.io/gimlet-io/image-builder:arm64-${{ steps.version.outputs.version }} | |
docker build \ | |
--platform linux/amd64 \ | |
-f docker/image-builder/Dockerfile \ | |
-t ghcr.io/gimlet-io/image-builder:amd64-${{ steps.version.outputs.version }} \ | |
--build-arg version=${{ steps.version.outputs.version }} \ | |
. | |
docker push ghcr.io/gimlet-io/image-builder:amd64-${{ steps.version.outputs.version }} | |
docker manifest create \ | |
ghcr.io/gimlet-io/image-builder:$version \ | |
--amend ghcr.io/gimlet-io/image-builder:amd64-$version \ | |
--amend ghcr.io/gimlet-io/image-builder:arm64-$version | |
docker manifest push ghcr.io/gimlet-io/image-builder:$version | |
env: | |
password: ${{ secrets.PAT }} # `PAT` is a secret that contains your Personal Access Token with `write:packages` scope | |
version: ${{ steps.version.outputs.version }} |