Skip to content
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

Build images for "stack removal" #153

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
})
- name: Install pack
run: |
curl -s -L -o pack.tgz ${{ steps.pack-download-url.outputs.result }}
curl -s -L -o pack.tgz https://github.com/buildpacks/pack/releases/download/v0.30.0-pre1/pack-v0.30.0-pre1-linux.tgz # TODO (the getLatestRelease endpoint doesn't support preleases so we'll need to undo this hardcoded usage of the pre-release...) ${{ steps.pack-download-url.outputs.result }}
tar -xvf pack.tgz
- name: Set config needed for image extensions
run: |
Expand Down
133 changes: 117 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,32 @@ clean: clean-linux clean-windows
## Linux
####################

build-linux: build-linux-stacks build-linux-packages build-linux-builders build-linux-buildpacks
build-linux: build-linux-stacks build-linux-images build-linux-packages build-linux-builders build-linux-buildpacks

build-linux-images: build-images-alpine build-images-jammy

build-linux-stacks: build-stack-alpine build-stack-jammy

build-alpine: build-stack-alpine build-builder-alpine build-buildpacks-alpine
build-alpine: build-stack-alpine build-images-alpine build-builder-alpine build-buildpacks-alpine

build-jammy: build-stack-jammy build-builder-jammy build-buildpacks-jammy
build-jammy: build-stack-jammy build-images-alpine build-builder-jammy build-buildpacks-jammy

build-stack-alpine:
@echo "> Building 'alpine' stack..."
bash stacks/build-stack.sh stacks/alpine

build-images-alpine:
@echo "> Building 'alpine' images..."
bash images/build-img.sh images/alpine

build-stack-jammy:
@echo "> Building 'jammy' stack..."
bash stacks/build-stack.sh stacks/jammy

build-images-jammy:
@echo "> Building 'jammy' images..."
bash images/build-img.sh images/jammy

build-linux-builders: build-builder-alpine build-builder-jammy

build-builder-alpine: build-linux-packages build-sample-root
Expand Down Expand Up @@ -78,7 +88,7 @@ build-linux-packages: build-sample-root
@echo "> Creating 'hello-universe' buildpack package"
$(PACK_CMD) buildpack package cnbs/sample-package:hello-universe --config $(SAMPLES_ROOT)/packages/hello-universe/package.toml $(PULL_POLICY_NEVER)

deploy-linux: deploy-linux-stacks deploy-linux-packages deploy-linux-builders
deploy-linux: deploy-linux-stacks deploy-linux-images deploy-linux-packages deploy-linux-builders

deploy-linux-stacks:
@echo "> Deploying 'alpine' stack..."
Expand All @@ -91,6 +101,18 @@ deploy-linux-stacks:
docker push cnbs/sample-stack-run:jammy
docker push cnbs/sample-stack-build:jammy

deploy-linux-images:
@echo "> Deploying 'alpine' images..."
docker push cnbs/sample-img-base:alpine
docker push cnbs/sample-img-run:alpine
docker push cnbs/sample-img-build:alpine

@echo "> Deploying 'jammy' images..."
docker push cnbs/sample-img-base:jammy
docker push cnbs/sample-img-run:jammy
docker push cnbs/sample-img-build:jammy


deploy-linux-packages:
@echo "> Deploying linux packages..."
docker push cnbs/sample-package:hello-world
Expand All @@ -115,6 +137,17 @@ clean-linux:
docker rmi cnbs/sample-stack-run:jammy || true
docker rmi cnbs/sample-stack-build:jammy || true

@echo "> Removing 'alpine' images..."
docker rmi cnbs/sample-img-base:alpine || true
docker rmi cnbs/sample-img-run:alpine || true
docker rmi cnbs/sample-img-build:alpine || true

@echo "> Removing 'jammy' images..."
docker rmi cnbs/sample-img-base:jammy || true
docker rmi cnbs/sample-img-run:jammy || true
docker rmi cnbs/sample-img-build:jammy || true


@echo "> Removing builders..."
docker rmi cnbs/sample-builder:alpine || true
docker rmi cnbs/sample-builder:jammy || true
Expand Down Expand Up @@ -149,12 +182,16 @@ set-experimental:
## Wine
####################

build-wine: build-stack-wine build-builder-wine build-buildpacks-wine
build-wine: build-stack-wine build-images-wine build-builder-wine build-buildpacks-wine

build-stack-wine:
@echo "> Building 'wine' stack..."
bash stacks/build-stack.sh stacks/wine

build-images-wine:
@echo "> Building 'wine' images..."
bash images/build-img.sh images/wine

build-builder-wine: build-sample-root
@echo "> Building 'wine' builder..."
$(PACK_CMD) create-builder cnbs/sample-builder:wine --config $(SAMPLES_ROOT)/builders/wine/builder.toml $(PULL_POLICY_NEVER)
Expand All @@ -170,13 +207,18 @@ build-buildpacks-wine: build-sample-root
@echo "> Creating 'hello-world-windows' app using 'wine' builder..."
$(PACK_CMD) build sample-hello-world-windows-app:wine -v --builder cnbs/sample-builder:wine --buildpack $(SAMPLES_ROOT)/buildpacks/hello-world-windows $(PULL_POLICY_NEVER) $(PACK_BUILD_FLAGS)

deploy-wine: deploy-wine-stacks deploy-wine-builders
deploy-wine: deploy-wine-stacks deploy-wine-images deploy-wine-builders

deploy-wine-stacks:
@echo "> Deploying 'wine' stack..."
docker push cnbs/sample-stack-run:wine
docker push cnbs/sample-stack-build:wine

deploy-wine-images:
@echo "> Deploying 'wine' images..."
docker push cnbs/sample-img-run:wine
docker push cnbs/sample-img-build:wine

deploy-wine-builders:
@echo "> Deploying 'wine' builder..."
docker push cnbs/sample-builder:wine
Expand All @@ -187,6 +229,11 @@ clean-wine:
docker rmi cnbs/sample-stack-run:wine || true
docker rmi cnbs/sample-stack-build:wine || true

@echo "> Removing 'wine' images..."
docker rmi cnbs/sample-img-base:wine || true
docker rmi cnbs/sample-img-run:wine || true
docker rmi cnbs/sample-img-build:wine || true

@echo "> Removing builders..."
docker rmi cnbs/sample-builder:wine || true

Expand All @@ -208,30 +255,46 @@ build-windows-2004: build-windows-packages build-dotnet-framework-2004

build-windows-2022: build-windows-packages build-dotnet-framework-2022

build-nanoserver-1809: build-stack-nanoserver-1809 build-builder-nanoserver-1809 build-buildpacks-nanoserver-1809
build-nanoserver-1809: build-stack-nanoserver-1809 build-images-nanoserver-1809 build-builder-nanoserver-1809 build-buildpacks-nanoserver-1809

build-dotnet-framework-1809: build-stack-dotnet-framework-1809 build-builder-dotnet-framework-1809 build-buildpacks-dotnet-framework-1809
build-dotnet-framework-1809: build-stack-dotnet-framework-1809 build-images-dotnet-framework-1809 build-builder-dotnet-framework-1809 build-buildpacks-dotnet-framework-1809

build-dotnet-framework-2004: build-stack-dotnet-framework-2004 build-builder-dotnet-framework-2004 build-buildpacks-dotnet-framework-2004
build-dotnet-framework-2004: build-stack-dotnet-framework-2004 build-images-dotnet-framework-2004 build-builder-dotnet-framework-2004 build-buildpacks-dotnet-framework-2004

build-dotnet-framework-2022: build-stack-dotnet-framework-2022 build-builder-dotnet-framework-2022 build-buildpacks-dotnet-framework-2022
build-dotnet-framework-2022: build-stack-dotnet-framework-2022 build-images-dotnet-framework-2022 build-builder-dotnet-framework-2022 build-buildpacks-dotnet-framework-2022

build-stack-nanoserver-1809:
@echo "> Building 'nanoserver-1809' stack..."
bash stacks/build-stack.sh stacks/nanoserver-1809

build-images-nanoserver-1809:
@echo "> Building 'nanoserver-1809' images..."
bash images/build-img.sh images/nanoserver-1809

build-stack-dotnet-framework-1809:
@echo "> Building 'dotnet-framework-1809' stack..."
bash stacks/build-stack.sh stacks/dotnet-framework-1809

build-images-dotnet-framework-1809:
@echo "> Building 'dotnet-framework-1809' images..."
bash images/build-img.sh images/dotnet-framework-1809

build-stack-dotnet-framework-2004:
@echo "> Building 'dotnet-framework-2004' stack..."
bash stacks/build-stack.sh stacks/dotnet-framework-2004

build-images-dotnet-framework-2004:
@echo "> Building 'dotnet-framework-2004' images..."
bash images/build-img.sh images/dotnet-framework-2004

build-stack-dotnet-framework-2022:
@echo "> Building 'dotnet-framework-2022' stack..."
bash stacks/build-stack.sh stacks/dotnet-framework-2022

build-images-dotnet-framework-2022:
@echo "> Building 'dotnet-framework-2022' images..."
bash images/build-img.sh images/dotnet-framework-2022

build-builder-nanoserver-1809: build-windows-packages
@echo "> Building 'nanoserver-1809' builder..."
$(PACK_CMD) builder create cnbs/sample-builder:nanoserver-1809 --config $(SAMPLES_ROOT)/builders/nanoserver-1809/builder.toml $(PULL_POLICY_NEVER)
Expand Down Expand Up @@ -279,39 +342,60 @@ deploy-windows-packages:
docker push cnbs/sample-package:hello-world-windows
docker push cnbs/sample-package:hello-universe-windows

deploy-windows-1809: deploy-windows-stacks-1809 deploy-windows-builders-1809
deploy-windows-1809: deploy-windows-stacks-1809 deploy-windows-images-1809 deploy-windows-builders-1809

deploy-windows-2004: deploy-windows-stacks-2004 deploy-windows-builders-2004
deploy-windows-2004: deploy-windows-stacks-2004 deploy-windows-images-2004 deploy-windows-builders-2004

deploy-windows-2022: deploy-windows-stacks-2022 deploy-windows-builders-2022
deploy-windows-2022: deploy-windows-stacks-2022 deploy-windows-images-2022 deploy-windows-builders-2022

deploy-windows-stacks-1809: deploy-windows-stacks-nanoserver-1809 deploy-windows-stacks-dotnet-framework-1809
deploy-windows-stacks-1809: deploy-windows-stacks-nanoserver-1809 deploy-windows-images-nanoserver-1809 deploy-windows-stacks-dotnet-framework-1809 deploy-windows-images-dotnet-framework-1809

deploy-windows-stacks-2004: deploy-windows-stacks-dotnet-framework-2004
deploy-windows-stacks-2004: deploy-windows-stacks-dotnet-framework-2004 deploy-windows-images-dotnet-framework-2004

deploy-windows-stacks-2022: deploy-windows-stacks-dotnet-framework-2022
deploy-windows-stacks-2022: deploy-windows-stacks-dotnet-framework-2022 deploy-windows-images-dotnet-framwork-2022

deploy-windows-stacks-nanoserver-1809:
@echo "> Deploying 'nanoserver-1809' stack..."
docker push cnbs/sample-stack-base:nanoserver-1809
docker push cnbs/sample-stack-run:nanoserver-1809
docker push cnbs/sample-stack-build:nanoserver-1809

deploy-windows-images-nanoserver-1809:
@echo "> Deploying 'nanoserver-1809' images..."
docker push cnbs/sample-img-base:nanoserver-1809
docker push cnbs/sample-img-run:nanoserver-1809
docker push cnbs/sample-img-build:nanoserver-1809

deploy-windows-stacks-dotnet-framework-1809:
@echo "> Deploying 'dotnet-framework-1809' stack..."
docker push cnbs/sample-stack-run:dotnet-framework-1809
docker push cnbs/sample-stack-build:dotnet-framework-1809

deploy-windows-images-dotnet-framework-1809:
@echo "> Deploying 'dotnet-framework-1809' images..."
docker push cnbs/sample-img-run:dotnet-framework-1809
docker push cnbs/sample-img-build:dotnet-framework-1809

deploy-windows-stacks-dotnet-framework-2004:
@echo "> Deploying 'dotnet-framework-2004' stack..."
docker push cnbs/sample-stack-run:dotnet-framework-2004
docker push cnbs/sample-stack-build:dotnet-framework-2004

deploy-windows-images-dotnet-framework-2004:
@echo "> Deploying 'dotnet-framework-2004' images..."
docker push cnbs/sample-images-run:dotnet-framework-2004
docker push cnbs/sample-images-build:dotnet-framework-2004

deploy-windows-stacks-dotnet-framework-2022:
@echo "> Deploying 'dotnet-framework-2022' stack..."
docker push cnbs/sample-stack-run:dotnet-framework-2022
docker push cnbs/sample-stack-build:dotnet-framework-2022

deploy-windows-images-dotnet-framework-2022:
@echo "> Deploying 'dotnet-framework-2022' images..."
docker push cnbs/sample-img-run:dotnet-framework-2022
docker push cnbs/sample-img-build:dotnet-framework-2022

deploy-windows-builders-1809: deploy-windows-builders-nanoserver-1809 deploy-windows-builders-dotnet-framework-1809

deploy-windows-builders-2004: deploy-windows-builders-dotnet-framework-2004
Expand Down Expand Up @@ -340,18 +424,35 @@ clean-windows:
docker rmi cnbs/sample-stack-run:nanoserver-1809 || true
docker rmi cnbs/sample-stack-build:nanoserver-1809 || true

@echo "> Removing 'nanoserver-1809' images..."
docker rmi cnbs/sample-img-base:nanoserver-1809 || true
docker rmi cnbs/sample-img-run:nanoserver-1809 || true
docker rmi cnbs/sample-img-build:nanoserver-1809 || true

@echo "> Removing 'dotnet-framework-1809' stack..."
docker rmi cnbs/sample-stack-run:dotnet-framework-1809 || true
docker rmi cnbs/sample-stack-build:dotnet-framework-1809 || true

@echo "> Removing 'dotnet-framework-1809' img..."
docker rmi cnbs/sample-img-run:dotnet-framework-1809 || true
docker rmi cnbs/sample-img-build:dotnet-framework-1809 || true

@echo "> Removing 'dotnet-framework-2004' stack..."
docker rmi cnbs/sample-stack-run:dotnet-framework-2004 || true
docker rmi cnbs/sample-stack-build:dotnet-framework-2004 || true

@echo "> Removing 'dotnet-framework-2004' img..."
docker rmi cnbs/sample-img-run:dotnet-framework-2004 || true
docker rmi cnbs/sample-img-build:dotnet-framework-2004 || true

@echo "> Removing 'dotnet-framework-2022' stack..."
docker rmi cnbs/sample-stack-run:dotnet-framework-2022 || true
docker rmi cnbs/sample-stack-build:dotnet-framework-2022 || true

@echo "> Removing 'dotnet-framework-2022' img..."
docker rmi cnbs/sample-img-run:dotnet-framework-2022 || true
docker rmi cnbs/sample-img-build:dotnet-framework-2022 || true

@echo "> Removing builders..."
docker rmi cnbs/sample-builder:nanoserver-1809 || true
docker rmi cnbs/sample-builder:dotnet-framework-1809 || true
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Includes:
- [Apps](apps/)
- [Buildpacks](buildpacks/)
- [Builders](builders/)
- [Stacks](stacks/)
- [Build and Run Images)](images/)
- [Stacks (deprecated in favor of build and run images)](stacks/)
- [Packages](packages/)


Expand Down
4 changes: 2 additions & 2 deletions builders/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ A sample of builders that use the [stacks](../stacks/) in this repo.

### What's next?

Is that all? If you want to dive deeper, there are two final components you might want to learn about:
- [Stacks](../stacks) marry the build-time and run-time environments for your code in the form of images under a common id.
Is that all? If you want to dive deeper take a look at:
- [Build and Run Images](../images) marry the build-time and run-time environments for your code in the form of images under a common id.
- [Buildpackages](../packages) allow easy distribution of buildpacks in image registries and simplify configuration and composition of builders and "meta" buildpacks.
14 changes: 9 additions & 5 deletions builders/alpine/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ version = "0.0.1"
id = "samples/curl"
version = "0.0.1"

# Stack that will be used by the builder
[stack]
id = "io.buildpacks.samples.stacks.alpine"
run-image = "cnbs/sample-stack-run:alpine"
build-image = "cnbs/sample-stack-build:alpine"
# Images that will be used by the builder
[build]
image = "cnbs/sample-img-build:alpine"


[run]
[[run.images]]
image = "cnbs/sample-img-run:alpine"

15 changes: 13 additions & 2 deletions builders/dotnet-framework-1809/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,19 @@ uri = "../../buildpacks/dotnet-framework"
id = "samples/dotnet-framework"
version = "0.0.1"

# Stack that will be used by the builder
# Images that will be used by the builder
[build]
image = "cnbs/sample-img-build:dotnet-framework-1809"


[run]
[[run.images]]
image = "cnbs/sample-img-run:dotnet-framework-1809"

# Note: This sample still includes the stack as an example of backwards compatibility.
# While stacks are now deprecated, you may wish to include both stacks and images during a migratory process or to ensure compatibility with older platforms
# When both are present, newer versions of pack will use the build and run images preferentially.
[stack]
id = "io.buildpacks.samples.stacks.dotnet-framework-1809"
run-image = "cnbs/sample-stack-run:dotnet-framework-1809"
build-image = "cnbs/sample-stack-build:dotnet-framework-1809"
build-image = "cnbs/sample-stack-build:dotnet-framework-1809"
11 changes: 10 additions & 1 deletion builders/dotnet-framework-2004/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,17 @@ uri = "../../buildpacks/dotnet-framework"
id = "samples/dotnet-framework"
version = "0.0.1"

# Images that will be used by the builder
[build]
image = "cnbs/sample-img-build:dotnet-framework-2004"


[run]
[[run.images]]
image = "cnbs/sample-img-run:dotnet-framework-2004"

# Stack that will be used by the builder
[stack]
id = "io.buildpacks.samples.stacks.dotnet-framework-2004"
run-image = "cnbs/sample-stack-run:dotnet-framework-2004"
build-image = "cnbs/sample-stack-build:dotnet-framework-2004"
build-image = "cnbs/sample-stack-build:dotnet-framework-2004"
14 changes: 9 additions & 5 deletions builders/dotnet-framework-2022/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ uri = "../../buildpacks/dotnet-framework"
id = "samples/dotnet-framework"
version = "0.0.1"

# Stack that will be used by the builder
[stack]
id = "io.buildpacks.samples.stacks.dotnet-framework-2022"
run-image = "cnbs/sample-stack-run:dotnet-framework-2022"
build-image = "cnbs/sample-stack-build:dotnet-framework-2022"
# Images that will be used by the builder
[build]
image = "cnbs/sample-img-build:dotnet-framework-2022"


[run]
[[run.images]]
image = "cnbs/sample-img-run:dotnet-framework-2022"

Loading