Skip to content

Commit

Permalink
Merge branch 'main' into migrate-to-exec.d
Browse files Browse the repository at this point in the history
  • Loading branch information
AidanDelaney authored Sep 25, 2023
2 parents b29a1e6 + 74d2716 commit b3f552b
Show file tree
Hide file tree
Showing 59 changed files with 525 additions and 553 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
# FIXME: Revert back to 'getLatestRelease' when pack v0.30.0 is released
# FIXME: Revert back to 'getLatestRelease' when pack v0.31.0 is released
script: |
return github.rest.repos.getReleaseByTag({
owner: "buildpacks",
repo: "pack",
tag: "v0.30.0-rc1"
tag: "v0.31.0-rc1"
}).then(result => {
return result.data.assets
.filter(a => a.name.includes("-linux.tgz"))
Expand Down Expand Up @@ -57,8 +57,6 @@ jobs:
strategy:
matrix:
include:
- os: windows-2019
version: 1809
- os: windows-2022
version: 2022
runs-on: ${{ matrix.os }}
Expand All @@ -70,10 +68,12 @@ jobs:
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
# FIXME: Revert back to 'getLatestRelease' when pack v0.31.0 is released
script: |
return github.rest.repos.getLatestRelease({
return github.rest.repos.getReleaseByTag({
owner: "buildpacks",
repo: "pack"
repo: "pack",
tag: "v0.31.0-rc1"
}).then(result => {
return result.data.assets
.filter(a => a.name.includes("windows"))
Expand Down
183 changes: 72 additions & 111 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ clean: clean-linux clean-windows
## Linux
####################

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

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

build-alpine: build-stack-alpine build-builder-alpine build-buildpacks-alpine
build-alpine: build-base-alpine build-builder-alpine build-buildpacks-alpine

build-jammy: build-stack-jammy build-builder-jammy build-buildpacks-jammy
build-jammy: build-base-jammy build-builder-jammy build-buildpacks-jammy

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

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

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

Expand Down Expand Up @@ -84,18 +84,18 @@ 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-bases deploy-linux-packages deploy-linux-builders

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

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

deploy-linux-packages:
@echo "> Deploying linux packages..."
Expand All @@ -111,15 +111,15 @@ deploy-linux-builders:
docker push cnbs/sample-builder:jammy

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

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

@echo "> Removing builders..."
docker rmi cnbs/sample-builder:alpine || true
Expand Down Expand Up @@ -155,50 +155,34 @@ set-experimental:
## Windows
####################

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

build-windows-2022: build-windows-packages build-dotnet-framework-2022
build-nanoserver-2022: build-base-nanoserver-2022 build-builder-nanoserver-2022 build-buildpacks-nanoserver-2022

build-nanoserver-1809: build-stack-nanoserver-1809 build-builder-nanoserver-1809 build-buildpacks-nanoserver-1809
build-dotnet-framework-2022: build-base-dotnet-framework-2022 build-builder-dotnet-framework-2022 build-buildpacks-dotnet-framework-2022

build-dotnet-framework-1809: build-stack-dotnet-framework-1809 build-builder-dotnet-framework-1809 build-buildpacks-dotnet-framework-1809
build-base-nanoserver-2022:
@echo "> Building 'nanoserver-2022' base images..."
bash base-images/build.sh nanoserver-2022

build-dotnet-framework-2022: build-stack-dotnet-framework-2022 build-builder-dotnet-framework-2022 build-buildpacks-dotnet-framework-2022
build-base-dotnet-framework-2022:
@echo "> Building 'dotnet-framework-2022' base images..."
bash base-images/build.sh dotnet-framework-2022

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

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

build-stack-dotnet-framework-2022:
@echo "> Building 'dotnet-framework-2022' stack..."
bash stacks/build-stack.sh stacks/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)

build-builder-dotnet-framework-1809: build-windows-packages
@echo "> Building 'dotnet-framework-1809' builder..."
$(PACK_CMD) builder create cnbs/sample-builder:dotnet-framework-1809 --config $(SAMPLES_ROOT)/builders/dotnet-framework-1809/builder.toml $(PULL_POLICY_NEVER)
build-builder-nanoserver-2022: build-windows-packages
@echo "> Building 'nanoserver-2022' builder..."
$(PACK_CMD) builder create cnbs/sample-builder:nanoserver-2022 --config $(SAMPLES_ROOT)/builders/nanoserver-2022/builder.toml $(PULL_POLICY_NEVER)

build-builder-dotnet-framework-2022: build-windows-packages
@echo "> Building 'dotnet-framework-2022' builder..."
$(PACK_CMD) builder create cnbs/sample-builder:dotnet-framework-2022 --config $(SAMPLES_ROOT)/builders/dotnet-framework-2022/builder.toml $(PULL_POLICY_NEVER)

build-buildpacks-nanoserver-1809: build-sample-root
@echo "> Creating 'hello-moon-windows' app using 'nanoserver-1809' builder..."
$(PACK_CMD) build sample-hello-moon-windows-app:nanoserver-1809 -v --builder cnbs/sample-builder:nanoserver-1809 --buildpack $(SAMPLES_ROOT)/buildpacks/hello-world-windows --buildpack $(SAMPLES_ROOT)/buildpacks/hello-moon-windows $(PULL_POLICY_NEVER) $(PACK_BUILD_FLAGS)

@echo "> Creating 'hello-world-windows' app using 'nanoserver-1809' builder..."
$(PACK_CMD) build sample-hello-world-windows-app:nanoserver-1809 -v --builder cnbs/sample-builder:nanoserver-1809 --buildpack $(SAMPLES_ROOT)/buildpacks/hello-world-windows $(PULL_POLICY_NEVER) $(PACK_BUILD_FLAGS)
build-buildpacks-nanoserver-2022: build-sample-root
@echo "> Creating 'hello-moon-windows' app using 'nanoserver-2022' builder..."
$(PACK_CMD) build sample-hello-moon-windows-app:nanoserver-2022 -v --builder cnbs/sample-builder:nanoserver-2022 --buildpack $(SAMPLES_ROOT)/buildpacks/hello-world-windows --buildpack $(SAMPLES_ROOT)/buildpacks/hello-moon-windows $(PULL_POLICY_NEVER) $(PACK_BUILD_FLAGS)

build-buildpacks-dotnet-framework-1809: build-sample-root
@echo "> Creating 'dotnet-framework' app using 'dotnet-framework-1809' builder..."
$(PACK_CMD) build sample-dotnet-framework-app:dotnet-framework-1809 -v --builder cnbs/sample-builder:dotnet-framework-1809 --buildpack $(SAMPLES_ROOT)/buildpacks/dotnet-framework --path apps/aspnet $(PULL_POLICY_NEVER) $(PACK_BUILD_FLAGS)
@echo "> Creating 'hello-world-windows' app using 'nanoserver-2022' builder..."
$(PACK_CMD) build sample-hello-world-windows-app:nanoserver-2022 -v --builder cnbs/sample-builder:nanoserver-2022 --buildpack $(SAMPLES_ROOT)/buildpacks/hello-world-windows $(PULL_POLICY_NEVER) $(PACK_BUILD_FLAGS)

build-buildpacks-dotnet-framework-2022: build-sample-root
@echo "> Creating 'dotnet-framework' app using 'dotnet-framework-2022' builder..."
Expand All @@ -216,72 +200,49 @@ 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-2022: deploy-windows-stacks-2022 deploy-windows-builders-2022
deploy-windows-2022: deploy-windows-bases-2022 deploy-windows-builders-2022

deploy-windows-stacks-1809: deploy-windows-stacks-nanoserver-1809 deploy-windows-stacks-dotnet-framework-1809
deploy-windows-bases-2022: deploy-windows-bases-dotnet-framework-2022 deploy-windows-bases-nanoserver-2022

deploy-windows-stacks-2022: deploy-windows-stacks-dotnet-framework-2022
deploy-windows-bases-nanoserver-2022:
@echo "> Deploying 'nanoserver-2022' base images..."
docker push cnbs/sample-base:nanoserver-2022
docker push cnbs/sample-base-run:nanoserver-2022
docker push cnbs/sample-base-build:nanoserver-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-bases-dotnet-framework-2022:
@echo "> Deploying 'dotnet-framework-2022' base images..."
docker push cnbs/sample-base-run:dotnet-framework-2022
docker push cnbs/sample-base-build:dotnet-framework-2022

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-builders-2022: deploy-windows-builders-dotnet-framework-2022 deploy-windows-builders-nanoserver-2022

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-builders-1809: deploy-windows-builders-nanoserver-1809 deploy-windows-builders-dotnet-framework-1809

deploy-windows-builders-2022: deploy-windows-builders-dotnet-framework-2022

deploy-windows-builders-nanoserver-1809:
@echo "> Deploying 'nanoserver-1809' builder..."
docker push cnbs/sample-builder:nanoserver-1809

deploy-windows-builders-dotnet-framework-1809:
@echo "> Deploying 'dotnet-framework-1809' builder..."
docker push cnbs/sample-builder:dotnet-framework-1809
deploy-windows-builders-nanoserver-2022:
@echo "> Deploying 'nanoserver-2022' builder..."
docker push cnbs/sample-builder:nanoserver-2022

deploy-windows-builders-dotnet-framework-2022:
@echo "> Deploying 'dotnet-framework-2022' builder..."
docker push cnbs/sample-builder:dotnet-framework-2022

clean-windows:
@echo "> Removing 'nanoserver-1809' stack..."
docker rmi cnbs/sample-stack-base:nanoserver-1809 || true
docker rmi cnbs/sample-stack-run:nanoserver-1809 || true
docker rmi cnbs/sample-stack-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 'nanoserver-2022' base images..."
docker rmi cnbs/sample-base:nanoserver-2022 || true
docker rmi cnbs/sample-base-run:nanoserver-2022 || true
docker rmi cnbs/sample-base-build:nanoserver-2022 || 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' base images..."
docker rmi cnbs/sample-base-run:dotnet-framework-2022 || true
docker rmi cnbs/sample-base-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
docker rmi cnbs/sample-builder:nanoserver-2022 || true
docker rmi cnbs/sample-builder:dotnet-framework-2022 || true

@echo "> Removing 'nanoserver-1809' apps..."
docker rmi sample-hello-moon-windows-app:nanoserver-1809 || true
docker rmi sample-hello-world-windows-app:nanoserver-1809 || true
docker rmi sample-batch-script-app:nanoserver-1809 || true

@echo "> Removing 'dotnet-framework-1809' apps..."
docker rmi sample-aspnet-app:dotnet-framework-1809 || true
@echo "> Removing 'nanoserver-2022' apps..."
docker rmi sample-hello-moon-windows-app:nanoserver-2022 || true
docker rmi sample-hello-world-windows-app:nanoserver-2022 || true
docker rmi sample-batch-script-app:nanoserver-2022 || true

@echo "> Removing 'dotnet-framework-2022' apps..."
docker rmi sample-aspnet-app:dotnet-framework-2022 || true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Includes:
- [Apps](apps/)
- [Buildpacks](buildpacks/)
- [Builders](builders/)
- [Stacks](stacks/)
- [Base Images](base-images/)
- [Packages](packages/)


Expand Down
10 changes: 2 additions & 8 deletions apps/bash-script/bash-script-buildpack/buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ id = "samples/bash-script"
version = "0.0.1"
name = "Bash Script Buildpack"

# Stacks that the buildpack will work with
# Stacks (deprecated) the buildpack will work with
[[stacks]]
id = "io.buildpacks.samples.stacks.jammy"

[[stacks]]
id = "io.buildpacks.samples.stacks.alpine"

[[stacks]]
id = "io.buildpacks.stacks.jammy"
id = "*"
2 changes: 1 addition & 1 deletion apps/batch-script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A runnable sample app demonstrating the usage of [project descriptor](https://gi
### Usage

```bash
pack build sample-batch-script-app --builder cnbs/sample-builder:nanoserver-1809 --trust-builder
pack build sample-batch-script-app --builder cnbs/sample-builder:nanoserver-2022 --trust-builder
```

### Extended Functionality
Expand Down
10 changes: 8 additions & 2 deletions apps/batch-script/batch-script-buildpack/buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ id = "samples/batch-script"
version = "0.0.1"
name = "Batch Script Buildpack"

# Stacks that the buildpack will work with
# Targets the buildpack will work with
[[targets]]
os = "windows"
[[targets.distros]]
version = "10.0.20348.1906"

# Stacks (deprecated) the buildpack will work with
[[stacks]]
id = "io.buildpacks.samples.stacks.nanoserver-1809"
id = "io.buildpacks.samples.stacks.nanoserver-2022"
2 changes: 1 addition & 1 deletion stacks/README.md → base-images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To build the stack use the `./build-stack` script:
```text
Usage:
./stacks/build-stack.sh [-f <prefix>] [-p <platform>] <dir>
-f prefix to use for images (default: cnbs/sample-stack)
-f prefix to use for images (default: cnbs/sample-base)
-p prefix to use for images (default: amd64)
<dir> directory of stack to build
```
Expand Down
14 changes: 14 additions & 0 deletions base-images/alpine/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM alpine:3

# Install packages that we want to make available at both build and run time
RUN apk add --update --no-cache bash ca-certificates

# Set required CNB target information
ARG distro_name
LABEL io.buildpacks.base.distro.name=${distro_name}
ARG distro_version
LABEL io.buildpacks.base.distro.version=${distro_version}

# Set deprecated CNB stack information (see https://buildpacks.io/docs/reference/spec/migration/platform-api-0.11-0.12/#stacks-are-deprecated-1)
ARG stack_id
LABEL io.buildpacks.stack.id="${stack_id}"
25 changes: 25 additions & 0 deletions base-images/alpine/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ARG base_image
FROM ${base_image}

# Install packages that we want to make available at build time
RUN apk add --update ca-certificates git jq wget && \
rm -rf /var/cache/apk/*

COPY ./bin/yj-linux /usr/local/bin/yj

# Create user and group
ARG cnb_uid=1000
ARG cnb_gid=1001
RUN addgroup -g ${cnb_gid} cnb && \
adduser -u ${cnb_uid} -G cnb -s /bin/bash -D cnb

# Set user and group
USER ${cnb_uid}:${cnb_gid}

# Set required CNB user information
ENV CNB_USER_ID=${cnb_uid}
ENV CNB_GROUP_ID=${cnb_gid}

# Set deprecated CNB stack information (see https://buildpacks.io/docs/reference/spec/migration/platform-api-0.11-0.12/#stacks-are-deprecated-1)
ARG stack_id
ENV CNB_STACK_ID=${stack_id}
File renamed without changes.
Loading

0 comments on commit b3f552b

Please sign in to comment.