Dockerfile不要でコンテナイメージが作成できるBuildpacksを使ってコンテナイメージを作ってみました。
Buildpacksとは
公式サイトより
Cloud Native Buildpacks transform your application source code into images that can run on any cloud. In this session you'll learn the basics of using buildpacks, why they make a great choice over the alternatives, and what new features the project has to offer. Cloud Native Buildpacks embrace modern container standards, such as the OCI image format. They take advantage of the latest capabilities of these standards, such as cross-repository blob mounting and image layer "rebasing" on Docker API v2 registries.
Cloud Native Buildpack は、アプリケーションのソースコードを、あらゆるクラウド上で実行可能なイメージに変換します。このセッションでは、ビルドパックの基本的な使い方、ビルドパックが他の選択肢より優れている理由、そしてプロジェクトが提供する新しい機能について学びます。Cloud Native Buildpack は、OCI イメージ形式のような最新のコンテナ標準を採用しています。これらの標準の最新機能、例えばリポジトリ間のBLOBマウントやDocker API v2レジストリ上でのイメージ層の「リベース」などを利用します。
Multipass環境の準備
Multipassを使用してVMを用意します。
MultipassのDocker入りVMを作成
multipass launch docker --name docker
Multipass起動
multipass shell docker
pack CLI
インストール
sudo add-apt-repository ppa:cncf-buildpacks/pack-cli
sudo apt-get update
sudo apt-get install pack-cli
自動補完の有効化
. $(pack completion)
Java - warファイル
Tomcatのサンプルアプリケーションを使ってみる。
準備
mkdir tomcat-sample
cd $_
wget https://tomcat.apache.org/tomcat-10.1-doc/appdev/sample/sample.war
ビルド
pack build tomcat-sample \
--builder paketobuildpacks/builder-jammy-base
出力
===> ANALYZING
[analyzer] Restoring data for SBOM from previous image
===> DETECTING
[detector] 8 of 24 buildpacks participating
[detector] paketo-buildpacks/ca-certificates 3.5.1
[detector] paketo-buildpacks/bellsoft-liberica 9.10.3
[detector] paketo-buildpacks/syft 1.23.0
[detector] paketo-buildpacks/apache-tomcat 7.11.1
[detector] paketo-buildpacks/apache-tomee 1.5.1
[detector] paketo-buildpacks/liberty 3.3.0
[detector] paketo-buildpacks/dist-zip 5.4.0
[detector] paketo-buildpacks/spring-boot 5.22.1
===> RESTORING
[restorer] Restoring metadata for "paketo-buildpacks/ca-certificates:helper" from app image
[restorer] Restoring metadata for "paketo-buildpacks/bellsoft-liberica:jre" from app image
[restorer] Restoring metadata for "paketo-buildpacks/bellsoft-liberica:helper" from app image
[restorer] Restoring metadata for "paketo-buildpacks/bellsoft-liberica:java-security-properties" from app image
[restorer] Restoring metadata for "paketo-buildpacks/bellsoft-liberica:jdk" from cache
[restorer] Restoring metadata for "paketo-buildpacks/syft:syft" from cache
[restorer] Restoring metadata for "paketo-buildpacks/liberty:base" from app image
[restorer] Restoring metadata for "paketo-buildpacks/liberty:helper" from app image
[restorer] Restoring metadata for "paketo-buildpacks/liberty:open-liberty-runtime-kernel" from app image
[restorer] Restoring data for "paketo-buildpacks/bellsoft-liberica:jdk" from cache
[restorer] Restoring data for "paketo-buildpacks/syft:syft" from cache
[restorer] Restoring data for "paketo-buildpacks/liberty:open-liberty-runtime-kernel" from cache
[restorer] Restoring data for SBOM from cache
===> BUILDING
[builder]
[builder] Paketo Buildpack for CA Certificates 3.5.1
[builder] https://github.com/paketo-buildpacks/ca-certificates
[builder] Launch Helper: Reusing cached layer
[builder]
[builder] Paketo Buildpack for BellSoft Liberica 9.10.3
[builder] https://github.com/paketo-buildpacks/bellsoft-liberica
[builder] Build Configuration:
[builder] $BP_JVM_JLINK_ARGS --no-man-pages --no-header-files --strip-debug --compress=1 configure custom link arguments (--output must be omitted)
[builder] $BP_JVM_JLINK_ENABLED false enables running jlink tool to generate custom JRE
[builder] $BP_JVM_TYPE JRE the JVM type - JDK or JRE
[builder] $BP_JVM_VERSION 11 the Java version
[builder] Launch Configuration:
[builder] $BPL_DEBUG_ENABLED false enables Java remote debugging support
[builder] $BPL_DEBUG_PORT 8000 configure the remote debugging port
[builder] $BPL_DEBUG_SUSPEND false configure whether to suspend execution until a debugger has attached
[builder] $BPL_HEAP_DUMP_PATH write heap dumps on error to this path
[builder] $BPL_JAVA_NMT_ENABLED true enables Java Native Memory Tracking (NMT)
[builder] $BPL_JAVA_NMT_LEVEL summary configure level of NMT, summary or detail
[builder] $BPL_JFR_ARGS configure custom Java Flight Recording (JFR) arguments
[builder] $BPL_JFR_ENABLED false enables Java Flight Recording (JFR)
[builder] $BPL_JMX_ENABLED false enables Java Management Extensions (JMX)
[builder] $BPL_JMX_PORT 5000 configure the JMX port
[builder] $BPL_JVM_HEAD_ROOM 0 the headroom in memory calculation
[builder] $BPL_JVM_LOADED_CLASS_COUNT 35% of classes the number of loaded classes in memory calculation
[builder] $BPL_JVM_THREAD_COUNT 250 the number of threads in memory calculation
[builder] $JAVA_TOOL_OPTIONS the JVM launch flags
[builder] Using buildpack default Java version 11
[builder] BellSoft Liberica JDK 11.0.18: Reusing cached layer
[builder] BellSoft Liberica JRE 11.0.18: Reusing cached layer
[builder] Launch Helper: Reusing cached layer
[builder] Java Security Properties: Reusing cached layer
[builder]
[builder] Paketo Buildpack for Syft 1.23.0
[builder] https://github.com/paketo-buildpacks/syft
[builder]
[builder] Paketo Buildpack for Apache Tomcat 7.11.1
[builder] https://github.com/paketo-buildpacks/apache-tomcat
[builder] Build Configuration:
[builder] $BP_JAVA_APP_SERVER the application server to use
[builder] $BP_TOMCAT_CONTEXT_PATH the application context path
[builder] $BP_TOMCAT_ENV_PROPERTY_SOURCE_DISABLED false Disable Tomcat's EnvironmentPropertySource
[builder] $BP_TOMCAT_EXT_CONF_SHA256 the SHA256 hash of the external Tomcat configuration archive
[builder] $BP_TOMCAT_EXT_CONF_STRIP 0 the number of directory components to strip from the external Tomcat configuration archive
[builder] $BP_TOMCAT_EXT_CONF_URI the download location of the external Tomcat configuration
[builder] $BP_TOMCAT_EXT_CONF_VERSION the version of the external Tomcat configuration
[builder] $BP_TOMCAT_VERSION 9.* the Tomcat version
[builder] Launch Configuration:
[builder] $BPL_TOMCAT_ACCESS_LOGGING_ENABLED the Tomcat access logging state
[builder] Apache Tomcat 9.0.71: Contributing to layer
[builder] Downloading from https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.71/bin/apache-tomcat-9.0.71.tar.gz
[builder] Verifying checksum
[builder] Expanding to /layers/paketo-buildpacks_apache-tomcat/tomcat
[builder] Writing env.launch/CATALINA_HOME.default
[builder] Launch Helper: Contributing to layer
[builder] Creating /layers/paketo-buildpacks_apache-tomcat/helper/exec.d/access-logging-support
[builder] Apache Tomcat Support: Contributing to layer
[builder] Copying context.xml to /layers/paketo-buildpacks_apache-tomcat/catalina-base/conf
[builder] Copying logging.properties to /layers/paketo-buildpacks_apache-tomcat/catalina-base/conf
[builder] Copying server.xml to /layers/paketo-buildpacks_apache-tomcat/catalina-base/conf
[builder] Copying web.xml to /layers/paketo-buildpacks_apache-tomcat/catalina-base/conf
[builder] Apache Tomcat Access Logging Support 3.4.0
[builder] Downloading from https://repo1.maven.org/maven2/org/cloudfoundry/tomcat-access-logging-support/3.4.0.RELEASE/tomcat-access-logging-support-3.4.0.RELEASE.jar
[builder] Verifying checksum
[builder] Copying to /layers/paketo-buildpacks_apache-tomcat/catalina-base/lib
[builder] Apache Tomcat Lifecycle Support 3.4.0
[builder] Downloading from https://repo1.maven.org/maven2/org/cloudfoundry/tomcat-lifecycle-support/3.4.0.RELEASE/tomcat-lifecycle-support-3.4.0.RELEASE.jar
[builder] Verifying checksum
[builder] Copying to /layers/paketo-buildpacks_apache-tomcat/catalina-base/lib
[builder] Apache Tomcat Logging Support 3.4.0
[builder] Downloading from https://repo1.maven.org/maven2/org/cloudfoundry/tomcat-logging-support/3.4.0.RELEASE/tomcat-logging-support-3.4.0.RELEASE.jar
[builder] Verifying checksum
[builder] Copying to /layers/paketo-buildpacks_apache-tomcat/catalina-base/bin
[builder] Writing /layers/paketo-buildpacks_apache-tomcat/catalina-base/bin/setenv.sh
[builder] Mounting application at ROOT
[builder] Writing env.launch/CATALINA_BASE.default
[builder] Writing env.launch/CATALINA_OPTS.default
[builder] Writing env.launch/CATALINA_TMPDIR.default
[builder] Process types:
[builder] task: bash catalina.sh run (direct)
[builder] tomcat: bash catalina.sh run (direct)
[builder] web: bash catalina.sh run (direct)
===> EXPORTING
[exporter] Reusing layer 'paketo-buildpacks/ca-certificates:helper'
[exporter] Reusing layer 'paketo-buildpacks/bellsoft-liberica:helper'
[exporter] Reusing layer 'paketo-buildpacks/bellsoft-liberica:java-security-properties'
[exporter] Reusing layer 'paketo-buildpacks/bellsoft-liberica:jre'
[exporter] Adding layer 'paketo-buildpacks/apache-tomcat:catalina-base'
[exporter] Adding layer 'paketo-buildpacks/apache-tomcat:helper'
[exporter] Adding layer 'paketo-buildpacks/apache-tomcat:tomcat'
[exporter] Adding layer 'launch.sbom'
[exporter] Adding 1/1 app layer(s)
[exporter] Reusing layer 'launcher'
[exporter] Adding layer 'config'
[exporter] Adding layer 'process-types'
[exporter] Adding label 'io.buildpacks.lifecycle.metadata'
[exporter] Adding label 'io.buildpacks.build.metadata'
[exporter] Adding label 'io.buildpacks.project.metadata'
[exporter] Setting default process type 'web'
[exporter] Saving tomcat-sample...
[exporter] *** Images (3c5d9a476369):
[exporter] tomcat-sample
[exporter] Reusing cache layer 'paketo-buildpacks/bellsoft-liberica:jdk'
[exporter] Reusing cache layer 'paketo-buildpacks/syft:syft'
[exporter] Adding cache layer 'cache.sbom'
Successfully built image tomcat-sample
pack inspect
pack inspect tomcat-sample
出力
Inspecting image: tomcat-sample
REMOTE:
(not present)
LOCAL:
Stack: io.buildpacks.stacks.jammy
Base Image:
Reference: 3f843ef5cc4a6add65ad43688bdcb8e2ba5756bde5620e9605737e9262416fc0
Top Layer: sha256:bfb5d9ae15ffa296d3774701c0016942220d4aefe26de43f921e66efd7c01398
Run Images:
index.docker.io/paketobuildpacks/run-jammy-base:latest
Buildpacks:
ID VERSION HOMEPAGE
paketo-buildpacks/ca-certificates 3.5.1 https://github.com/paketo-buildpacks/ca-certificates
paketo-buildpacks/bellsoft-liberica 9.10.3 https://github.com/paketo-buildpacks/bellsoft-liberica
paketo-buildpacks/syft 1.23.0 https://github.com/paketo-buildpacks/syft
paketo-buildpacks/apache-tomcat 7.11.1 https://github.com/paketo-buildpacks/apache-tomcat
paketo-buildpacks/apache-tomee 1.5.1 https://github.com/paketo-buildpacks/apache-tomee
paketo-buildpacks/liberty 3.3.0 https://github.com/paketo-buildpacks/liberty
paketo-buildpacks/dist-zip 5.4.0 https://github.com/paketo-buildpacks/dist-zip
paketo-buildpacks/spring-boot 5.22.1 https://github.com/paketo-buildpacks/spring-boot
Processes:
TYPE SHELL COMMAND ARGS WORK DIR
web (default) bash catalina.sh run /workspace
task bash catalina.sh run /workspace
tomcat bash catalina.sh run /workspace
コンテナ起動
docker run --rm -p 8080:8080 -d tomcat-sample
http://172.25.230.111:8080/
にアクセス。(http://172.25.230.111:8080/sample
ではありません。)
まぁ素敵
Java - Gradle
Spring PetClinic Sample Applicationを使ってみる。
準備
cd ~
git clone https://github.com/spring-projects/spring-petclinic.git
cd spring-petclinic
ビルド
JavaのバージョンをBP_JVM_VERSIONで指定します。
pack build spring-petclinic \
--builder paketobuildpacks/builder-jammy-base \
--env BP_JVM_VERSION=17
出力
===> ANALYZING
[analyzer] Previous image with name "spring-petclinic" not found
===> DETECTING
[detector] 11 of 24 buildpacks participating
[detector] paketo-buildpacks/ca-certificates 3.5.1
[detector] paketo-buildpacks/bellsoft-liberica 9.10.3
[detector] paketo-buildpacks/syft 1.23.0
[detector] paketo-buildpacks/gradle 6.10.0
[detector] paketo-buildpacks/maven 6.12.1
[detector] paketo-buildpacks/executable-jar 6.5.0
[detector] paketo-buildpacks/apache-tomcat 7.11.1
[detector] paketo-buildpacks/apache-tomee 1.5.1
[detector] paketo-buildpacks/liberty 3.3.0
[detector] paketo-buildpacks/dist-zip 5.4.0
[detector] paketo-buildpacks/spring-boot 5.22.1
===> RESTORING
===> BUILDING
[builder]
[builder] Paketo Buildpack for CA Certificates 3.5.1
[builder] https://github.com/paketo-buildpacks/ca-certificates
[builder] Launch Helper: Contributing to layer
[builder] Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
[builder]
[builder] Paketo Buildpack for BellSoft Liberica 9.10.3
[builder] https://github.com/paketo-buildpacks/bellsoft-liberica
[builder] Build Configuration:
[builder] $BP_JVM_JLINK_ARGS --no-man-pages --no-header-files --strip-debug --compress=1 configure custom link arguments (--output must be omitted)
[builder] $BP_JVM_JLINK_ENABLED false enables running jlink tool to generate custom JRE
[builder] $BP_JVM_TYPE JRE the JVM type - JDK or JRE
[builder] $BP_JVM_VERSION 17 the Java version
[builder] Launch Configuration:
[builder] $BPL_DEBUG_ENABLED false enables Java remote debugging support
[builder] $BPL_DEBUG_PORT 8000 configure the remote debugging port
[builder] $BPL_DEBUG_SUSPEND false configure whether to suspend execution until a debugger has attached
[builder] $BPL_HEAP_DUMP_PATH write heap dumps on error to this path
[builder] $BPL_JAVA_NMT_ENABLED true enables Java Native Memory Tracking (NMT)
[builder] $BPL_JAVA_NMT_LEVEL summary configure level of NMT, summary or detail
[builder] $BPL_JFR_ARGS configure custom Java Flight Recording (JFR) arguments
[builder] $BPL_JFR_ENABLED false enables Java Flight Recording (JFR)
[builder] $BPL_JMX_ENABLED false enables Java Management Extensions (JMX)
[builder] $BPL_JMX_PORT 5000 configure the JMX port
[builder] $BPL_JVM_HEAD_ROOM 0 the headroom in memory calculation
[builder] $BPL_JVM_LOADED_CLASS_COUNT 35% of classes the number of loaded classes in memory calculation
[builder] $BPL_JVM_THREAD_COUNT 250 the number of threads in memory calculation
[builder] $JAVA_TOOL_OPTIONS the JVM launch flags
[builder] Using Java version 17 from BP_JVM_VERSION
[builder] BellSoft Liberica JDK 17.0.6: Contributing to layer
[builder] Downloading from https://github.com/bell-sw/Liberica/releases/download/17.0.6+10/bellsoft-jdk17.0.6+10-linux-amd64.tar.gz
[builder] Verifying checksum
[builder] Expanding to /layers/paketo-buildpacks_bellsoft-liberica/jdk
[builder] Adding 124 container CA certificates to JVM truststore
[builder] Writing env.build/JAVA_HOME.override
[builder] Writing env.build/JDK_HOME.override
[builder] BellSoft Liberica JRE 17.0.6: Contributing to layer
[builder] Downloading from https://github.com/bell-sw/Liberica/releases/download/17.0.6+10/bellsoft-jre17.0.6+10-linux-amd64.tar.gz
[builder] Verifying checksum
[builder] Expanding to /layers/paketo-buildpacks_bellsoft-liberica/jre
[builder] Adding 124 container CA certificates to JVM truststore
[builder] Writing env.launch/BPI_APPLICATION_PATH.default
[builder] Writing env.launch/BPI_JVM_CACERTS.default
[builder] Writing env.launch/BPI_JVM_CLASS_COUNT.default
[builder] Writing env.launch/BPI_JVM_SECURITY_PROVIDERS.default
[builder] Writing env.launch/JAVA_HOME.default
[builder] Writing env.launch/JAVA_TOOL_OPTIONS.append
[builder] Writing env.launch/JAVA_TOOL_OPTIONS.delim
[builder] Writing env.launch/MALLOC_ARENA_MAX.default
[builder] Launch Helper: Contributing to layer
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/active-processor-count
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/java-opts
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jvm-heap
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/link-local-dns
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/memory-calculator
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/security-providers-configurer
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jmx
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jfr
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/security-providers-classpath-9
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/debug-9
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/nmt
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/openssl-certificate-loader
[builder] Java Security Properties: Contributing to layer
[builder] Writing env.launch/JAVA_SECURITY_PROPERTIES.default
[builder] Writing env.launch/JAVA_TOOL_OPTIONS.append
[builder] Writing env.launch/JAVA_TOOL_OPTIONS.delim
[builder]
[builder] Paketo Buildpack for Syft 1.23.0
[builder] https://github.com/paketo-buildpacks/syft
[builder] Downloading from https://github.com/anchore/syft/releases/download/v0.62.1/syft_0.62.1_linux_amd64.tar.gz
[builder] Verifying checksum
[builder] Writing env.build/SYFT_CHECK_FOR_APP_UPDATE.default
[builder]
[builder] Paketo Buildpack for Gradle 6.10.0
[builder] https://github.com/paketo-buildpacks/gradle
[builder] Build Configuration:
[builder] $BP_EXCLUDE_FILES colon separated list of glob patterns, matched source files are removed
[builder] $BP_GRADLE_BUILD_ARGUMENTS --no-daemon assemble the arguments to pass to Gradle
[builder] $BP_GRADLE_BUILD_FILE the location of the main build config file, relative to the application root
[builder] $BP_GRADLE_BUILT_ARTIFACT build/libs/*.[jw]ar the built application artifact explicitly. Supersedes $BP_GRADLE_BUILT_MODULE
[builder] $BP_GRADLE_BUILT_MODULE the module to find application artifact in
[builder] $BP_GRADLE_INIT_SCRIPT_PATH the path to a Gradle init script file
[builder] $BP_INCLUDE_FILES colon separated list of glob patterns, matched source files are included
[builder] Creating cache directory /home/cnb/.gradle
[builder] Compiled Application: Contributing to layer
[builder] Executing gradlew --no-daemon assemble
[builder] Downloading https://services.gradle.org/distributions/gradle-7.5.1-bin.zip
[builder] ...........10%............20%...........30%............40%...........50%............60%...........70%............80%...........90%............100%
[builder]
[builder] Welcome to Gradle 7.5.1!
[builder]
[builder] Here are the highlights of this release:
[builder] - Support for Java 18
[builder] - Support for building with Groovy 4
[builder] - Much more responsive continuous builds
[builder] - Improved diagnostics for dependency resolution
[builder]
[builder] For more details see https://docs.gradle.org/7.5.1/release-notes.html
[builder]
[builder] To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.5.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
[builder] Daemon will be stopped at the end of the build
[builder] > Task :compileJava
[builder] > Task :processResources
[builder] > Task :classes
[builder] > Task :resolveMainClassName
[builder] > Task :bootJar
[builder] > Task :jar
[builder] > Task :assemble
[builder]
[builder] BUILD SUCCESSFUL in 1m 46s
[builder] 5 actionable tasks: 5 executed
[builder]
[builder] Removing source code
[builder] Restoring multiple artifacts
[builder]
[builder] Paketo Buildpack for Maven 6.12.1
[builder] https://github.com/paketo-buildpacks/maven
[builder] Build Configuration:
[builder] $BP_EXCLUDE_FILES colon separated list of glob patterns, matched source files are removed
[builder] $BP_INCLUDE_FILES colon separated list of glob patterns, matched source files are included
[builder] $BP_MAVEN_BUILD_ARGUMENTS -Dmaven.test.skip=true --no-transfer-progress package the arguments to pass to Maven
[builder] $BP_MAVEN_BUILT_ARTIFACT target/*.[ejw]ar the built application artifact explicitly. Supersedes $BP_MAVEN_BUILT_MODULE
[builder] $BP_MAVEN_BUILT_MODULE the module to find application artifact in
[builder] $BP_MAVEN_DAEMON_ENABLED false use maven daemon
[builder] $BP_MAVEN_POM_FILE pom.xml the location of the main pom.xml file, relative to the application root
[builder] $BP_MAVEN_SETTINGS_PATH the path to a Maven settings file
[builder] $BP_MAVEN_VERSION 3 the Maven version
[builder] Apache Maven 3.8.7: Contributing to layer
[builder] Downloading from https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.tar.gz
[builder] Verifying checksum
[builder] Expanding to /layers/paketo-buildpacks_maven/maven
[builder] Creating cache directory /home/cnb/.m2
[builder]
[builder] Paketo Buildpack for Executable JAR 6.5.0
[builder] https://github.com/paketo-buildpacks/executable-jar
[builder] Process types:
[builder] executable-jar: java -jar /workspace/spring-petclinic-3.0.0.jar (direct)
[builder] task: java -jar /workspace/spring-petclinic-3.0.0.jar (direct)
[builder] web: java -jar /workspace/spring-petclinic-3.0.0.jar (direct)
===> EXPORTING
[exporter] Adding layer 'paketo-buildpacks/ca-certificates:helper'
[exporter] Adding layer 'paketo-buildpacks/bellsoft-liberica:helper'
[exporter] Adding layer 'paketo-buildpacks/bellsoft-liberica:java-security-properties'
[exporter] Adding layer 'paketo-buildpacks/bellsoft-liberica:jre'
[exporter] Adding layer 'launch.sbom'
[exporter] Adding 1/1 app layer(s)
[exporter] Adding layer 'launcher'
[exporter] Adding layer 'config'
[exporter] Adding layer 'process-types'
[exporter] Adding label 'io.buildpacks.lifecycle.metadata'
[exporter] Adding label 'io.buildpacks.build.metadata'
[exporter] Adding label 'io.buildpacks.project.metadata'
[exporter] Setting default process type 'web'
[exporter] Saving spring-petclinic...
[exporter] *** Images (d43de243a0b7):
[exporter] spring-petclinic
[exporter] Adding cache layer 'paketo-buildpacks/bellsoft-liberica:jdk'
[exporter] Adding cache layer 'paketo-buildpacks/syft:syft'
[exporter] Adding cache layer 'paketo-buildpacks/gradle:application'
[exporter] Adding cache layer 'paketo-buildpacks/gradle:cache'
[exporter] Adding cache layer 'paketo-buildpacks/maven:cache'
[exporter] Adding cache layer 'paketo-buildpacks/maven:maven'
[exporter] Adding cache layer 'cache.sbom'
Successfully built image spring-petclinic
pack inst
pack inspect spring-petclinic
出力
Inspecting image: spring-petclinic
REMOTE:
(not present)
LOCAL:
Stack: io.buildpacks.stacks.jammy
Base Image:
Reference: 3f843ef5cc4a6add65ad43688bdcb8e2ba5756bde5620e9605737e9262416fc0
Top Layer: sha256:bfb5d9ae15ffa296d3774701c0016942220d4aefe26de43f921e66efd7c01398
Run Images:
index.docker.io/paketobuildpacks/run-jammy-base:latest
Buildpacks:
ID VERSION HOMEPAGE
paketo-buildpacks/ca-certificates 3.5.1 https://github.com/paketo-buildpacks/ca-certificates
paketo-buildpacks/bellsoft-liberica 9.10.3 https://github.com/paketo-buildpacks/bellsoft-liberica
paketo-buildpacks/syft 1.23.0 https://github.com/paketo-buildpacks/syft
paketo-buildpacks/gradle 6.10.0 https://github.com/paketo-buildpacks/gradle
paketo-buildpacks/maven 6.12.1 https://github.com/paketo-buildpacks/maven
paketo-buildpacks/executable-jar 6.5.0 https://github.com/paketo-buildpacks/executable-jar
paketo-buildpacks/apache-tomcat 7.11.1 https://github.com/paketo-buildpacks/apache-tomcat
paketo-buildpacks/apache-tomee 1.5.1 https://github.com/paketo-buildpacks/apache-tomee
paketo-buildpacks/liberty 3.3.0 https://github.com/paketo-buildpacks/liberty
paketo-buildpacks/dist-zip 5.4.0 https://github.com/paketo-buildpacks/dist-zip
paketo-buildpacks/spring-boot 5.22.1 https://github.com/paketo-buildpacks/spring-boot
Processes:
TYPE SHELL COMMAND ARGS WORK DIR
web (default) java -jar /workspace/spring-petclinic-3.0.0.jar /workspace
executable-jar java -jar /workspace/spring-petclinic-3.0.0.jar /workspace
task java -jar /workspace/spring-petclinic-3.0.0.jar /workspace
コンテナ起動
docker run --rm -p 8080:8080 -d spring-petclinic
http://172.25.230.111:8080/
にアクセス。
まぁ素敵
PHP
WordPressを使ってみる。
準備
cd ~/
git clone https://github.com/WordPress/WordPress.git
cd WordPress/
ビルド
PHPの場合はFULL
イメージを使用します
pack build wordpress \
--builder paketobuildpacks/builder-jammy-full
出力
===> ANALYZING
[analyzer] Previous image with name "wordpress" not found
===> DETECTING
[detector] 2 of 9 buildpacks participating
[detector] paketo-buildpacks/php-dist 2.0.4
[detector] paketo-buildpacks/php-builtin-server 0.4.3
===> RESTORING
===> BUILDING
[builder] Paketo Buildpack for PHP Distribution 2.0.4
[builder] Resolving PHP version
[builder] Candidate version sources (in priority order):
[builder] <unknown> -> ""
[builder]
[builder] Selected PHP version (using <unknown>): 8.1.15
[builder]
[builder] Executing build process
[builder] Installing PHP 8.1.15
[builder] Completed in 4.011s
[builder]
[builder] Generating SBOM for /layers/paketo-buildpacks_php-dist/php
[builder] Completed in 0s
[builder]
[builder] Generating default PHP configuration
[builder]
[builder] Configuring build environment
[builder] MIBDIRS -> "/layers/paketo-buildpacks_php-dist/php/mibs"
[builder] PATH -> "/layers/paketo-buildpacks_php-dist/php/sbin:$PATH"
[builder] PHPRC -> "/layers/paketo-buildpacks_php-dist/php/etc"
[builder] PHP_API -> "20210902"
[builder] PHP_EXTENSION_DIR -> "/layers/paketo-buildpacks_php-dist/php/lib/php/extensions/no-debug-non-zts-20210902"
[builder] PHP_HOME -> "/layers/paketo-buildpacks_php-dist/php"
[builder] PHP_INI_SCAN_DIR -> "$PHP_INI_SCAN_DIR:/layers/paketo-buildpacks_php-dist/php/etc:/layers/paketo-buildpacks_php-dist/php/etc:/workspace/.php.ini.d"
[builder]
[builder] Configuring launch environment
[builder] MIBDIRS -> "/layers/paketo-buildpacks_php-dist/php/mibs"
[builder] PATH -> "/layers/paketo-buildpacks_php-dist/php/sbin:$PATH"
[builder] PHPRC -> "/layers/paketo-buildpacks_php-dist/php/etc"
[builder] PHP_API -> "20210902"
[builder] PHP_EXTENSION_DIR -> "/layers/paketo-buildpacks_php-dist/php/lib/php/extensions/no-debug-non-zts-20210902"
[builder] PHP_HOME -> "/layers/paketo-buildpacks_php-dist/php"
[builder] PHP_INI_SCAN_DIR -> "$PHP_INI_SCAN_DIR:/layers/paketo-buildpacks_php-dist/php/etc:/layers/paketo-buildpacks_php-dist/php/etc:/workspace/.php.ini.d"
[builder]
[builder] Paketo Buildpack for PHP Built-in Server 0.4.3
[builder] Assigning launch processes:
[builder] web (default): bash -c php -S 0.0.0.0:"${PORT:-80}" -t /workspace
[builder]
===> EXPORTING
[exporter] Adding layer 'paketo-buildpacks/php-dist:php'
[exporter] Adding layer 'launch.sbom'
[exporter] Adding 1/1 app layer(s)
[exporter] Adding layer 'launcher'
[exporter] Adding layer 'config'
[exporter] Adding layer 'process-types'
[exporter] Adding label 'io.buildpacks.lifecycle.metadata'
[exporter] Adding label 'io.buildpacks.build.metadata'
[exporter] Adding label 'io.buildpacks.project.metadata'
[exporter] Setting default process type 'web'
[exporter] Saving wordpress...
[exporter] *** Images (83bb204dd0c1):
[exporter] wordpress
Successfully built image wordpress
pack inspect
pack inspect wordpress
出力
Inspecting image: wordpress
REMOTE:
Stack:
Base Image:
Top Layer:
Run Images:
(none)
Buildpacks:
(buildpack metadata not present)
LOCAL:
Stack: io.buildpacks.stacks.jammy
Base Image:
Reference: 21d92b23ba03c7f778a2612196ffae5ea3e80b5f4912529011f94bd141d6769e
Top Layer: sha256:6077f757cef24208a06b29c50c8b959fb8d515230a371b1a094840961a58ac5e
Run Images:
index.docker.io/paketobuildpacks/run-jammy-full:latest
Buildpacks:
ID VERSION HOMEPAGE
paketo-buildpacks/php-dist 2.0.4 https://github.com/paketo-buildpacks/php-dist
paketo-buildpacks/php-builtin-server 0.4.3 https://github.com/paketo-buildpacks/php-builtin-server
Processes:
TYPE SHELL COMMAND ARGS WORK DIR
web (default) bash -c php -S 0.0.0.0:"${PORT:-80}" -t /workspace /workspace
コンテナ起動
docker run --rm -p 80:80 -d wordpress
http://172.25.230.111:80/
にアクセス。(ポートは80番です)
まぁ素敵