diff --git a/index/server/Dockerfile b/index/server/Dockerfile index a377f3ad..002c8ff8 100644 --- a/index/server/Dockerfile +++ b/index/server/Dockerfile @@ -40,6 +40,10 @@ RUN set -x ; \ # Modify the permissions on the necessary files to allow the container to properly run as a non-root UID RUN mkdir -p /www/data && chmod -R g+rwx /www/data +# Add license +RUN mkdir -p /licenses +COPY LICENSE /licenses + # disable http/2 on the index server by default ARG ENABLE_HTTP2=false ENV ENABLE_HTTP2=${ENABLE_HTTP2} diff --git a/index/server/build-multi-arch.sh b/index/server/build-multi-arch.sh index 6dc1d1fe..87b5ff05 100644 --- a/index/server/build-multi-arch.sh +++ b/index/server/build-multi-arch.sh @@ -30,6 +30,9 @@ PLATFORMS="linux/amd64,linux/arm64" # Generate OpenAPI endpoint and type definitions bash ${buildfolder}/codegen.sh +# Copy license to include in image build +cp ${buildfolder}/../../LICENSE ${buildfolder}/LICENSE + if [ ${podman} == true ]; then echo "Executing with podman" @@ -52,4 +55,7 @@ else docker buildx rm index-base-builder -fi \ No newline at end of file +fi + +# Remove license from build directory +rm ${buildfolder}/LICENSE diff --git a/index/server/build.sh b/index/server/build.sh index c7e8d3cd..53fbd9e7 100755 --- a/index/server/build.sh +++ b/index/server/build.sh @@ -41,6 +41,14 @@ echo "RUNNING: bash ${buildfolders}/codegen.sh" # Generate OpenAPI endpoint and type definitions bash ${buildfolder}/codegen.sh +echo "RUNNING: cp ${buildfolder}/../../LICENSE ${buildfolder}/LICENSE" +# Copy license to include in image build +cp ${buildfolder}/../../LICENSE ${buildfolder}/LICENSE + echo "RUNNING: docker build -t devfile-index-base:latest --platform ${arch} --build-arg ENABLE_HTTP2=${ENABLE_HTTP2} $buildfolder" # Build the index server docker build -t devfile-index-base:latest --platform "${arch}" --build-arg ENABLE_HTTP2=${ENABLE_HTTP2} $buildfolder + +echo "RUNNING: rm ${buildfolder}/LICENSE" +# Remove license from build directory +rm ${buildfolder}/LICENSE diff --git a/oci-registry/Dockerfile b/oci-registry/Dockerfile index d29d55e4..e0f5fe1b 100644 --- a/oci-registry/Dockerfile +++ b/oci-registry/Dockerfile @@ -21,7 +21,13 @@ RUN microdnf update -y && rm -rf /var/cache/yum && microdnf install ca-certifica RUN set -x ; \ adduser registry -u 1001 -G root && exit 0 +# Copy OCI registry binary from container image COPY --from=registry --chown=registry:0 /bin/registry /bin/registry + +# Add license +RUN mkdir -p /licenses +COPY LICENSE /licenses + USER 1001 EXPOSE 5000 ENTRYPOINT ["registry"] diff --git a/oci-registry/build-multi-arch.sh b/oci-registry/build-multi-arch.sh index ade1e7b0..bdf4ef36 100644 --- a/oci-registry/build-multi-arch.sh +++ b/oci-registry/build-multi-arch.sh @@ -48,6 +48,8 @@ function engine-handler { done } +# Copy license to include in image build +cp ${buildfolder}/../LICENSE ${buildfolder}/LICENSE if [ ${podman} == true ]; then echo "Executing with podman" @@ -78,4 +80,7 @@ else docker manifest push "$DEFAULT_MANIFEST" docker manifest rm "$DEFAULT_MANIFEST" -fi \ No newline at end of file +fi + +# Remove license from build directory +rm ${buildfolder}/LICENSE diff --git a/oci-registry/build.sh b/oci-registry/build.sh index ca8f7eeb..e7103646 100755 --- a/oci-registry/build.sh +++ b/oci-registry/build.sh @@ -32,4 +32,10 @@ fi # set podman alias if necessary . ${buildfolder}/../setenv.sh +# Copy license to include in image build +cp ${buildfolder}/../LICENSE ${buildfolder}/LICENSE + docker build -t oci-registry:next --platform "${arch}" "$buildfolder" + +# Remove license from build directory +rm ${buildfolder}/LICENSE diff --git a/tests/integration/Dockerfile b/tests/integration/Dockerfile index d719062b..38324ce2 100644 --- a/tests/integration/Dockerfile +++ b/tests/integration/Dockerfile @@ -24,4 +24,8 @@ RUN cd /registry-test/registry-library && ./build.sh && cp /registry-test/regist # Build the test binary RUN /registry-test/build.sh +# Add license +RUN mkdir -p /licenses +COPY LICENSE /licenses + CMD /registry-test/devfile-registry-integration \ No newline at end of file diff --git a/tests/integration/docker-build.sh b/tests/integration/docker-build.sh index a9facd38..e6bd6fa5 100755 --- a/tests/integration/docker-build.sh +++ b/tests/integration/docker-build.sh @@ -20,7 +20,13 @@ # Get the registry-library cp -rf ../../registry-library ./ +# Copy license to include in image build +cp ../../LICENSE LICENSE + # Build the container image docker build -t devfile-registry-integration ./ +# Remove license from build directory +rm LICENSE + rm -rf ./registry-library/ \ No newline at end of file