This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.2.6.2. 사용자 정의 빌드 아티팩트 생성
사용자 정의 빌드 이미지로 사용할 이미지를 생성해야 합니다.
프로세스
빈 디렉터리에서부터 다음 콘텐츠를 사용하여
Dockerfile
이라는 파일을 생성합니다.Copy to Clipboard Copied! Toggle word wrap Toggle overflow FROM registry.redhat.io/rhel8/buildah # In this example, `/tmp/build` contains the inputs that build when this # custom builder image is run. Normally the custom builder image fetches # this content from some location at build time, by using git clone as an example. ADD dockerfile.sample /tmp/input/Dockerfile ADD build.sh /usr/bin RUN chmod a+x /usr/bin/build.sh # /usr/bin/build.sh contains the actual custom build logic that will be run when # this custom builder image is run. ENTRYPOINT ["/usr/bin/build.sh"]
FROM registry.redhat.io/rhel8/buildah # In this example, `/tmp/build` contains the inputs that build when this # custom builder image is run. Normally the custom builder image fetches # this content from some location at build time, by using git clone as an example. ADD dockerfile.sample /tmp/input/Dockerfile ADD build.sh /usr/bin RUN chmod a+x /usr/bin/build.sh # /usr/bin/build.sh contains the actual custom build logic that will be run when # this custom builder image is run. ENTRYPOINT ["/usr/bin/build.sh"]
동일한 디렉터리에서
dockerfile.sample
이라는 파일을 생성합니다. 이 파일은 사용자 정의 빌드 이미지에 포함되어 있으며 사용자 정의 빌드에서 생성하는 이미지를 정의합니다.Copy to Clipboard Copied! Toggle word wrap Toggle overflow FROM registry.access.redhat.com/ubi8/ubi RUN touch /tmp/build
FROM registry.access.redhat.com/ubi8/ubi RUN touch /tmp/build
동일한 디렉터리에
build.sh
라는 파일을 생성합니다. 이 파일에는 사용자 정의 빌드가 실행될 때 실행되는 논리가 포함되어 있습니다.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note that in this case the build inputs are part of the custom builder image, but normally this is retrieved from an external source. OUTPUT_REGISTRY and OUTPUT_IMAGE are env variables provided by the custom build framework performs the build of the new image defined by dockerfile.sample buildah requires a slight modification to the push secret provided by the service account to use it for pushing the image push the new image to the target for the build
#!/bin/sh # Note that in this case the build inputs are part of the custom builder image, but normally this # is retrieved from an external source. cd /tmp/input # OUTPUT_REGISTRY and OUTPUT_IMAGE are env variables provided by the custom # build framework TAG="${OUTPUT_REGISTRY}/${OUTPUT_IMAGE}" # performs the build of the new image defined by dockerfile.sample buildah --storage-driver vfs bud --isolation chroot -t ${TAG} . # buildah requires a slight modification to the push secret provided by the service # account to use it for pushing the image cp /var/run/secrets/openshift.io/push/.dockercfg /tmp (echo "{ \"auths\": " ; cat /var/run/secrets/openshift.io/push/.dockercfg ; echo "}") > /tmp/.dockercfg # push the new image to the target for the build buildah --storage-driver vfs push --tls-verify=false --authfile /tmp/.dockercfg ${TAG}