Merge branch 'main' into update-bundler

This commit is contained in:
Aidan Delaney 2023-07-26 08:05:21 +01:00 committed by GitHub
commit 262eba1c2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 155 additions and 289 deletions

View File

@ -28,4 +28,4 @@ jobs:
docker load -i /tmp/workspace/images/image.tgz
docker run -d -p 8080:8080 cnbs/circleci-sample
sleep 40
curl -k localhost:8080
curl -k localhost:8080

View File

@ -22,10 +22,12 @@ jobs:
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
# FIXME: Revert back to 'getLatestRelease' when pack v0.30.0 is released
script: |
return github.rest.repos.getLatestRelease({
return github.rest.repos.getReleaseByTag({
owner: "buildpacks",
repo: "pack"
repo: "pack",
tag: "v0.30.0-pre3"
}).then(result => {
return result.data.assets
.filter(a => a.name.includes("-linux.tgz"))
@ -40,7 +42,7 @@ jobs:
./pack config experimental true
./pack config pull-policy always
- name: Build
run: PACK_CMD=./pack make build-linux build-wine
run: PACK_CMD=./pack make build-linux
- uses: azure/docker-login@v1
if: ${{ github.ref == 'refs/heads/main' }}
with:
@ -48,9 +50,9 @@ jobs:
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Deploy
if: ${{ github.ref == 'refs/heads/main' }}
run: make deploy-linux deploy-wine
run: make deploy-linux
- name: Clean up
run: make clean-linux clean-wine
run: make clean-linux
build-deploy-windows:
strategy:
matrix:

View File

@ -37,20 +37,26 @@ build-builder-jammy: build-linux-packages build-sample-root
build-linux-buildpacks: build-buildpacks-alpine build-buildpacks-jammy
build-buildpacks-alpine: build-sample-root
@echo "> Starting local registry to store alpine builder (when builder contains extensions it must exist in a registry so that builds can use --pull-policy=always and we don't want to override the locally built builder)"
docker run -d --rm -p 5000:5000 registry:2
sleep 2
docker tag cnbs/sample-builder:alpine localhost:5000/cnbs/sample-builder:alpine
docker push localhost:5000/cnbs/sample-builder:alpine
@echo "> Creating 'hello-moon' app using 'alpine' builder..."
$(PACK_CMD) build sample-hello-moon-app:alpine -v --builder cnbs/sample-builder:alpine --buildpack $(SAMPLES_ROOT)/buildpacks/hello-world --buildpack $(SAMPLES_ROOT)/buildpacks/hello-moon $(PACK_BUILD_FLAGS)
$(PACK_CMD) build sample-hello-moon-app:alpine -v --builder localhost:5000/cnbs/sample-builder:alpine --buildpack $(SAMPLES_ROOT)/buildpacks/hello-world --buildpack $(SAMPLES_ROOT)/buildpacks/hello-moon --network=host
@echo "> Creating 'hello-processes' app using 'alpine' builder..."
$(PACK_CMD) build sample-hello-processes-app:alpine -v --builder cnbs/sample-builder:alpine --buildpack $(SAMPLES_ROOT)/buildpacks/hello-processes $(PACK_BUILD_FLAGS)
$(PACK_CMD) build sample-hello-processes-app:alpine -v --builder localhost:5000/cnbs/sample-builder:alpine --buildpack $(SAMPLES_ROOT)/buildpacks/hello-processes --network=host
@echo "> Creating 'hello-world' app using 'alpine' builder..."
$(PACK_CMD) build sample-hello-world-app:alpine -v --builder cnbs/sample-builder:alpine --buildpack $(SAMPLES_ROOT)/buildpacks/hello-world $(PACK_BUILD_FLAGS)
$(PACK_CMD) build sample-hello-world-app:alpine -v --builder localhost:5000/cnbs/sample-builder:alpine --buildpack $(SAMPLES_ROOT)/buildpacks/hello-world --network=host
@echo "> Creating 'java-maven' app using 'alpine' builder..."
$(PACK_CMD) build sample-java-maven-app:alpine -v --builder cnbs/sample-builder:alpine --path apps/java-maven $(PACK_BUILD_FLAGS)
$(PACK_CMD) build sample-java-maven-app:alpine -v --builder localhost:5000/cnbs/sample-builder:alpine --path apps/java-maven --network=host
@echo "> Creating 'kotlin-gradle' app using 'alpine' builder..."
$(PACK_CMD) build sample-kotlin-gradle-app:alpine -v --builder cnbs/sample-builder:alpine --path apps/kotlin-gradle $(PACK_BUILD_FLAGS)
$(PACK_CMD) build sample-kotlin-gradle-app:alpine -v --builder localhost:5000/cnbs/sample-builder:alpine --path apps/kotlin-gradle --network=host
build-buildpacks-jammy: build-sample-root
@echo "> Creating 'hello-moon' app using 'jammy' builder..."
@ -145,59 +151,6 @@ set-experimental:
@echo "> Setting experimental"
$(PACK_CMD) config experimental true
####################
## Wine
####################
build-wine: build-stack-wine build-builder-wine build-buildpacks-wine
build-stack-wine:
@echo "> Building 'wine' stack..."
bash stacks/build-stack.sh stacks/wine
build-builder-wine: build-sample-root
@echo "> Building 'wine' builder..."
$(PACK_CMD) builder create cnbs/sample-builder:wine --config $(SAMPLES_ROOT)/builders/wine/builder.toml $(PULL_POLICY_NEVER)
build-wine-apps: build-sample-root
@echo "> Creating 'batch-script' app using 'wine' builder..."
$(PACK_CMD) build sample-batch-script-app:wine -v --builder cnbs/sample-builder:wine --path apps/batch-script $(PULL_POLICY_NEVER) $(PACK_BUILD_FLAGS)
build-buildpacks-wine: build-sample-root
@echo "> Creating 'hello-moon-windows' app using 'wine' builder..."
$(PACK_CMD) build sample-hello-moon-windows-app:wine -v --builder cnbs/sample-builder:wine --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 '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-stacks:
@echo "> Deploying 'wine' stack..."
docker push cnbs/sample-stack-run:wine
docker push cnbs/sample-stack-build:wine
deploy-wine-builders:
@echo "> Deploying 'wine' builder..."
docker push cnbs/sample-builder:wine
clean-wine:
@echo "> Removing 'wine' stack..."
docker rmi cnbs/sample-stack-base:wine || true
docker rmi cnbs/sample-stack-run:wine || true
docker rmi cnbs/sample-stack-build:wine || true
@echo "> Removing builders..."
docker rmi cnbs/sample-builder:wine || true
@echo "> Removing 'wine' apps..."
docker rmi sample-hello-moon-windows-app:wine || true
docker rmi sample-hello-world-windows-app:wine || true
docker rmi sample-batch-script-app:wine || true
@echo "> Removing '.tmp'"
rm -rf .tmp
####################
## Windows
####################

View File

@ -1,5 +1,5 @@
# Buildpack API version
api = "0.2"
api = "0.9"
# Buildpack ID and metadata
[buildpack]

View File

@ -1,5 +1,5 @@
# Buildpack API version
api = "0.2"
api = "0.9"
# Buildpack ID and metadata
[buildpack]
@ -10,6 +10,3 @@ name = "Batch Script Buildpack"
# Stacks that the buildpack will work with
[[stacks]]
id = "io.buildpacks.samples.stacks.nanoserver-1809"
[[stacks]]
id = "io.buildpacks.samples.stacks.wine"

View File

@ -28,6 +28,11 @@ id = "samples/curl"
version = "0.0.1"
uri = "../../extensions/curl"
[[extensions]]
id = "samples/cowsay"
version = "0.0.1"
uri = "../../extensions/cowsay"
# Order used for detection (buildpacks)
[[order]]
[[order.group]]
@ -59,6 +64,10 @@ version = "0.0.1"
id = "samples/curl"
version = "0.0.1"
[[order-extensions.group]]
id = "samples/cowsay"
version = "0.0.1"
# Stack that will be used by the builder
[stack]
id = "io.buildpacks.samples.stacks.alpine"

View File

@ -1,78 +0,0 @@
# Sample Wine Builder
A Linux builder that runs a Windows lifecycle using the [Wine emulation layer](https://www.winehq.org/) within a Linux container. Provides an emulated Windows environment for detect/build phases but generates _**unrunnable**_ app images by default.
Supported `pack build` cases:
* Test basic Windows buildpacks.
* Build and inspect minimal Windows app images.
* Test Windows lifecycle implementations ([example](#Test-Windows-lifecycle-implementations)).
* Build or rebase an app image with a runnable Windows run image ([example](#Build-and-publish-a-runnable-Windows-app-image-to-a-registry)).
What is **not** supported:
* Creating runnable app images on a local daemon, due to Windows/Linux image formatting differences.
* Using buildpackages, due to Windows/Linux layer formatting differences.
### Prerequisites
* [Pack](https://buildpacks.io/docs/install-pack/)
* Docker daemon with Linux container support
### Usage
#### Creating the builder
```bash
pack create-builder cnbs/sample-builder:wine --config builder.toml
```
#### Build app with builder
```bash
pack build sample-app --builder cnbs/sample-builder:wine --path ../../apps/batch-script/
```
_Note: After building, app is not runnable but can be inspected with `docker` or `dive`._
#### Test Windows lifecycle implementations
```bash
# Replace with locally built lifecycle tarball
sed -i.bak '$s!uri = .*!uri = "../../../lifecycle/out/lifecycle-v0.0.0+windows.x86-64.tgz"!' builder.toml
pack create-builder cnbs/sample-builder:wine --config builder.toml
pack build sample-app --builder cnbs/sample-builder:wine --trust-builder
```
#### Build and publish a runnable Windows app image to a registry
```bash
myrepo=<your repo name ex: "docker.io/cnbs">
crane copy mcr.microsoft.com/windows/nanoserver:1809-amd64 ${myrepo}/sample-stack-run:nanoserver-1809-wine
crane mutate ${myrepo}/sample-stack-run:nanoserver-1809-wine --label io.buildpacks.stack.id=io.buildpacks.samples.stacks.wine
pack build ${myrepo}/sample-app:wine \
--publish \
--run-image ${myrepo}/sample-stack-run:nanoserver-1809-wine \
--builder cnbs/sample-builder:wine \
--path ../../apps/batch-script/ \
--trust-builder
```
After, with a WCOW daemon
```bash
docker run --rm ${myrepo}/sample-app:wine
## output: Buildpacks.io ASCII banner
```
### How it works
* Builder is a Linux image but with a Windows lifecycle.
* Linux build-phase container runs [`lifecycle-wrapper.sh`](../../stacks/wine/build/bin/lifecycle-wrapper.sh) instead of normal Linux `lifecycle` binary.
* Lifecycle wrapper does the following:
* Maps Linux container CNB dirs into Wine environment.
* Sets up Wine dependencies.
* Proxies `/var/run/docker.sock` to `127.0.0.1:2375` and sets `DOCKER_HOST`.
* Execs `wine lifecycle.exe`, using phase name and arguments.
* `lifecycle.exe` runs normally as if in a Windows runtime environment:
* Executes Windows-formatted buildpack executables (`.bat`,`.exe`), profile scripts, etc.
* Exports app images in Windows format to either a registry or local daemon (with `scratch`-based run-image, unless otherwise specified).

View File

@ -1,19 +0,0 @@
# Buildpacks to include in builder
[[buildpacks]]
uri = "../../buildpacks/hello-world-windows"
# Order used for detection
[[order]]
[[order.group]]
id = "samples/hello-world-windows"
version = "0.0.1"
# Stack that will be used by the builder
[stack]
id = "io.buildpacks.samples.stacks.wine"
run-image = "cnbs/sample-stack-run:wine"
build-image = "cnbs/sample-stack-build:wine"
# Requires explicit Windows lifecycle to override pack's Linux default
[lifecycle]
uri = "https://github.com/buildpacks/lifecycle/releases/download/v0.10.2/lifecycle-v0.10.2+windows.x86-64.tgz"

View File

@ -15,6 +15,7 @@ if not exist %layer_path% (
if not exist %layer_toml_path% (
(
echo [types]
echo launch = false
echo build = true
echo cache = true
@ -40,5 +41,5 @@ if %ERRORLEVEL% NEQ 0 (
(
echo [[processes]]
echo type = "web"
echo command = "C:\\ServiceMonitor.exe w3svc"
echo command = ["C:\\ServiceMonitor.exe", "w3svc"]
) >> %launch_toml_path%

View File

@ -1,4 +1,4 @@
api = "0.2"
api = "0.9"
[buildpack]
id = "samples/dotnet-framework"

View File

@ -13,4 +13,9 @@ type = "curl"
command = ["curl"]
args = ["--version"]
default = true
[[processes]]
type = "cowsay"
command = ["cowsay"]
args = ["MOOOO!"]
EOL

View File

@ -1,16 +1,32 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ -z "${BP_EXT_DEMO}" ]]; then
exit 100
fi
# 1. GET ARGS
plan_path=$2
# 2. DECLARE DEPENDENCIES (OPTIONAL)
cat >> "${plan_path}" <<EOL
# Uncomment first
#[[requires]]
#name = "tree"
# Uncomment second
#[[requires]]
#name = "curl"
if [[ "${BP_REQUIRES}" == *"tree"* ]]; then
cat >>"${plan_path}" <<EOL
[[requires]]
name = "tree"
EOL
fi
if [[ "${BP_REQUIRES}" == *"curl"* ]]; then
cat >>"${plan_path}" <<EOL
[[requires]]
name = "curl"
EOL
fi
if [[ "${BP_REQUIRES}" == *"cowsay"* ]]; then
cat >>"${plan_path}" <<EOL
[[requires]]
name = "cowsay"
EOL
fi

View File

@ -2,10 +2,13 @@
echo --- Hello Moon buildpack
set env_dir=%2\env
:: INPUT ARGUMENTS
set platform_dir=%2
set env_dir=%platform_dir%\env
set layers_dir=%1
set plan_path=%3
:: ENV VARS
echo env_dir: %env_dir%
echo env_vars:
for /f "tokens=*" %%f in ('dir /s /q /b %env_dir%') do (
@ -17,7 +20,10 @@ for /f "tokens=*" %%o in ('set') do (
echo %%o
)
:: LAYERS
echo layers_dir: %layers_dir%
:: PLAN
echo plan_path: %plan_path%
echo plan contents:
for /f "tokens=*" %%o in ('type %plan_path%') do (

View File

@ -1,5 +1,5 @@
# Buildpack API version
api = "0.2"
api = "0.9"
# Buildpack ID and metadata
[buildpack]
@ -20,6 +20,3 @@ id = "io.buildpacks.samples.stacks.dotnet-framework-1809"
[[stacks]]
id = "io.buildpacks.samples.stacks.dotnet-framework-2022"
[[stacks]]
id = "io.buildpacks.samples.stacks.wine"

View File

@ -1,5 +1,5 @@
# Buildpack API version
api = "0.2"
api = "0.9"
# Buildpack ID and metadata
[buildpack]

View File

@ -4,9 +4,8 @@ set -eo pipefail
echo "---> Hello processes buildpack"
# INPUT ARGUMENTS
env_dir=$2/env
layers_dir=$1
plan_path=$3
env_dir=$2/env
# ADD SYS-INFO PROCESS
echo "---> Adding sys-info process"
@ -14,6 +13,7 @@ sysinfo_layer_dir="${layers_dir}/sys-info"
mkdir -p ${sysinfo_layer_dir}
cat > "${sysinfo_layer_dir}.toml" << EOF
[types]
launch = true
EOF
@ -30,7 +30,7 @@ chmod +x ${sysinfo_script}
cat >> "${layers_dir}/launch.toml" <<EOL
[[processes]]
type = "sys-info"
command = "${sysinfo_script}"
command = ["${sysinfo_script}"]
EOL
echo "---> Done"

View File

@ -1,5 +1,5 @@
# Buildpack API version
api = "0.2"
api = "0.9"
# Buildpack ID and metadata
[buildpack]

View File

@ -1,5 +1,5 @@
# Buildpack API version
api = "0.2"
api = "0.9"
# Buildpack ID and metadata
[buildpack]

View File

@ -1,5 +1,5 @@
# Buildpack API version
api = "0.2"
api = "0.9"
# Buildpack ID and metadata
[buildpack]

View File

@ -1,5 +1,5 @@
# Buildpack API version
api = "0.2"
api = "0.9"
# Buildpack ID and metadata
[buildpack]
@ -16,6 +16,3 @@ id = "io.buildpacks.samples.stacks.nanoserver-1809"
[[stacks]]
id = "io.buildpacks.samples.stacks.dotnet-framework-2022"
[[stacks]]
id = "io.buildpacks.samples.stacks.wine"

View File

@ -1,5 +1,5 @@
# Buildpack API version
api = "0.2"
api = "0.9"
# Buildpack ID and metadata
[buildpack]

View File

@ -42,6 +42,7 @@ if [[ ${jdk_url} != ${cached_jdk_url} ]] ; then
wget -q -O - "$jdk_url" | tar pxz -C "${jdk_layer_dir}" --strip-components=1
cat > "${jdk_layer_dir}.toml" << EOF
[types]
launch = true
build = true
cache = true
@ -80,7 +81,10 @@ export PATH=${jdk_layer_dir}/bin:$PATH
m2_layer_dir="${layers_dir}/maven_m2"
if [[ ! -d ${m2_layer_dir} ]]; then
mkdir -p ${m2_layer_dir}
echo "cache = true" > ${m2_layer_dir}.toml
cat > ${m2_layer_dir}.toml << EOF
[types]
cache = true
EOF
fi
ln -s ${m2_layer_dir} $HOME/.m2
@ -101,6 +105,7 @@ else
mkdir -p "${maven_layer_dir}"
wget -q -O - "${maven_url}" | tar pxz -C "${maven_layer_dir}" --strip-components=1
cat > "${maven_layer_dir}.toml" << EOF
[types]
launch = true
build = true
cache = true
@ -122,7 +127,8 @@ for jar_file in $(find "$target_dir" -maxdepth 1 -name "*.jar" -type f); do
cat >> "${layers_dir}/launch.toml" <<EOL
[[processes]]
type = "web"
command = "java -jar ${jar_file}"
command = ["java", "-jar", "${jar_file}"]
default = true
EOL
break;
done

View File

@ -1,5 +1,5 @@
# Buildpack API version
api = "0.2"
api = "0.9"
# Buildpack ID and metadata
[buildpack]

View File

@ -39,6 +39,7 @@ if [[ ${jdk_url} != ${cached_jdk_url} ]] ; then
wget -q -O - "$jdk_url" | tar pxz -C "${jdk_layer_dir}" --strip-components=1
cat > "${jdk_layer_dir}.toml" << EOF
[types]
launch = true
build = true
cache = true
@ -77,13 +78,16 @@ gradle_layer_dir="${layers_dir}/gradle"
if [[ ! -d ${gradle_layer_dir} ]]; then
mkdir -p ${gradle_layer_dir}
echo "cache = true" > ${gradle_layer_dir}.toml
cat >> ${gradle_layer_dir}.toml <<EOF
[types]
cache = true
EOF
fi
ln -s ${gradle_layer_dir} $HOME/.gradle
# 5. RUN BUILD
echo "---> Running Gradle Wrapper"
./gradlew clean build -x test --no-daemon
GRADLE_OPTS=-Dorg.gradle.daemon=false ./gradlew clean build -x test
# 6. SET DEFAULT START COMMAND
target_dir="build/libs"
@ -91,7 +95,7 @@ for jar_file in $(find "$target_dir" -maxdepth 1 -name "*.jar" -type f); do
cat >> "${layers_dir}/launch.toml" <<EOL
[[processes]]
type = "web"
command = "java -jar ${jar_file}"
command = ["java", "-jar", "${jar_file}"]
EOL
break;
done

View File

@ -1,5 +1,5 @@
# Buildpack API version
api = "0.2"
api = "0.9"
# Buildpack ID and metadata
[buildpack]

View File

@ -12,7 +12,7 @@ ruby_layer_dir="${layers_dir}/ruby"
mkdir -p "${ruby_layer_dir}"
# determine ruby version provided during detection
ruby_version=$(cat "${plan_path}" | yj -t | jq -r '.entries[] | select(.name == "ruby") | .version')
ruby_version=$(cat "${plan_path}" | yj -t | jq -r '.entries[] | select(.name == "ruby") | .metadata.version')
echo "---> Downloading and extracting Ruby ${ruby_version}"
ruby_url=https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-22/ruby-${ruby_version}.tgz
@ -20,6 +20,7 @@ wget -q -O - "${ruby_url}" | tar -xzf - -C "${ruby_layer_dir}"
# 3. MAKE RUBY AVAILABLE DURING LAUNCH
cat > "${ruby_layer_dir}.toml" <<EOL
[types]
launch = true
metadata = "${ruby_version}"
EOL
@ -45,6 +46,7 @@ else
echo "---> Installing gems"
mkdir -p "${bundler_layer_dir}"
cat > "${bundler_layer_dir}.toml" <<EOL
[types]
cache = true
launch = true
metadata = "${local_bundler_checksum}"
@ -56,8 +58,8 @@ fi
cat >> "${layers_dir}/launch.toml" <<EOL
[[processes]]
type = "web"
command = "bundle exec ruby app.rb"
command = ["bundle", "exec", "ruby", "app.rb"]
[[processes]]
type = "worker"
command = "bundle exec ruby worker.rb"
command = ["bundle", "exec", "ruby", "worker.rb"]
EOL

View File

@ -1,5 +1,5 @@
# Buildpack API version
api = "0.2"
api = "0.9"
# Buildpack ID and metadata
[buildpack]

12
extensions/cowsay/bin/detect Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail
# 1. GET ARGS
plan_path=$CNB_BUILD_PLAN_PATH
# 2. DECLARE DEPENDENCIES (OPTIONAL)
cat >> "${plan_path}" <<EOL
# Extension provides this dependency
[[provides]]
name = "cowsay"
EOL

19
extensions/cowsay/bin/generate Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -eo pipefail
# 1. GET ARGS
output_dir=$CNB_OUTPUT_DIR
# 2. GENERATE run.Dockerfile
cat >>"${output_dir}/run.Dockerfile" <<EOL
ARG base_image
FROM \${base_image}
RUN curl --version
USER root
RUN apk update && apk add cowsay
ARG user_id
USER \${user_id}
EOL

View File

@ -0,0 +1,10 @@
# Buildpack API version
api = "0.10"
# Extension ID and metadata
[extension]
id = "samples/cowsay"
version = "0.0.1"
name = "Cowsay Extension"
homepage = "https://github.com/buildpacks/samples/tree/main/extensions/cowsay"
description = "A simple extension that installs cowsay on the runtime base image"

View File

@ -5,6 +5,6 @@ set -eo pipefail
output_dir=$CNB_OUTPUT_DIR
# 2. GENERATE run.Dockerfile
cat >> "${output_dir}/run.Dockerfile" <<EOL
FROM run-image-curl
cat >>"${output_dir}/run.Dockerfile" <<EOL
FROM localhost:5000/run-image-curl
EOL

View File

@ -7,4 +7,4 @@ id = "samples/curl"
version = "0.0.1"
name = "Curl Extension"
homepage = "https://github.com/buildpacks/samples/tree/main/extensions/curl"
description = "A simple extension that switches the runtime base image to `curlimages/curl:latest`"
description = "A simple extension that switches the runtime base image to `run-image-curl`, based on `curlimages/curl`"

View File

@ -10,5 +10,9 @@ ARG base_image
FROM \${base_image}
USER root
RUN apk update update && apk add tree
RUN apk update && apk add tree
ARG user_id
USER \${user_id}
EOL

View File

@ -7,4 +7,4 @@ id = "samples/tree"
version = "0.0.1"
name = "Tree Extension"
homepage = "https://github.com/buildpacks/samples/tree/main/extensions/tree"
description = "A simple extension that installs tree at build time"
description = "A simple extension that installs tree on the builder image"

View File

@ -1,4 +1,4 @@
FROM alpine:3
FROM --platform=linux/amd64 alpine:3
ARG cnb_uid=1000
ARG cnb_gid=1001

View File

@ -1,5 +1,7 @@
FROM curlimages/curl
RUN curl --version
ARG cnb_uid=1000
ARG cnb_gid=1001

View File

@ -1,4 +1,4 @@
FROM ubuntu:jammy
FROM --platform=linux/amd64 ubuntu:jammy
ARG cnb_uid=1000
ARG cnb_gid=1000

View File

@ -1,39 +0,0 @@
FROM ubuntu:jammy
# Install packages that we want to make available at build time
# Base + Wine 32/64bit + dependencies
RUN dpkg --add-architecture i386 && \
apt update && \
DEBIAN_FRONTEND=noninteractive apt install -y \
xz-utils ca-certificates \
git wget wine64 wine32 xvfb x11-apps socat && \
rm -rf /var/lib/apt/lists/*
# Create symlinks for lifecycle executables to wrapper. The wrapper creates the Wine environment and calls lifecycle.exe
COPY ./bin/lifecycle-wrapper.sh /cnb/lifecycle/analyzer
COPY ./bin/lifecycle-wrapper.sh /cnb/lifecycle/builder
COPY ./bin/lifecycle-wrapper.sh /cnb/lifecycle/creator
COPY ./bin/lifecycle-wrapper.sh /cnb/lifecycle/detector
COPY ./bin/lifecycle-wrapper.sh /cnb/lifecycle/exporter
COPY ./bin/lifecycle-wrapper.sh /cnb/lifecycle/rebaser
COPY ./bin/lifecycle-wrapper.sh /cnb/lifecycle/restorer
RUN chmod 555 /cnb/lifecycle/*
ARG cnb_uid=1000
ARG cnb_gid=1000
# Create user and group
RUN groupadd cnb --gid ${cnb_gid} && \
useradd --uid ${cnb_uid} --gid ${cnb_gid} -m -s /bin/bash cnb
# Set required CNB information
ENV CNB_USER_ID=${cnb_uid}
ENV CNB_GROUP_ID=${cnb_gid}
# Set required CNB information
ARG stack_id
ENV CNB_STACK_ID=${stack_id}
LABEL io.buildpacks.stack.id=${stack_id}
# Set user and group (as declared in base image)
USER ${CNB_USER_ID}:${CNB_GROUP_ID}

View File

@ -1,31 +0,0 @@
#!/bin/bash
set -o errexit -o pipefail -o nounset
# symlink CNB directories into C:
mkdir -p $HOME/.wine/drive_c/
ln -s /cnb $HOME/.wine/drive_c/
ln -s /layers $HOME/.wine/drive_c/
ln -s /platform $HOME/.wine/drive_c/
ln -s /cache $HOME/.wine/drive_c/
ln -s /workspace $HOME/.wine/drive_c/
# remove debug messages
export WINEDEBUG=fixme-all,-ole,+msgbox # suppress non-fatal messages: "fixme:", "err:ole"; log all "invisible" msgbox messages & Structured Error Handling failures
export WINEDLLOVERRIDES="mscoree,mshtml=" # suppress wine-gecko messages
# start background Xvfb for wine X11 dependency
export DISPLAY=:0.0
nohup Xvfb :0 -screen 0 1024x768x16 -nolisten unix &
# start background socat to proxy between /var/run/docker.sock and tcp://localhost:2375, and override default //./pipe/docker_engine
socat TCP-LISTEN:2375,reuseaddr,fork,bind=127.0.0.1 UNIX-CLIENT:/var/run/docker.sock &
export DOCKER_HOST=tcp://localhost:2375
# run wine once before running lifecycle to isolate setup errors
if ! wine cmd /c exit 0 > /tmp/wine-build-init.log 2>&1; then
echo "Wine stack wrapper failed to initialize:"
cat /tmp/wine-build-init.log
exit 1
fi
exec wine64 $0.exe $*

View File

@ -1,9 +0,0 @@
# Based on scratch since lifecycle will export Windows-formatted images that cannot run on Linux but can be inspected and rebased.
FROM scratch
# Set required CNB information
ARG stack_id
LABEL io.buildpacks.stack.id="${stack_id}"
# Add any file to create a minimal top layer, required for pack
COPY Dockerfile /top-layer-placeholder