Skip to content

Commit

Permalink
add license to container images
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Valdron <[email protected]>
  • Loading branch information
michael-valdron committed Nov 4, 2024
1 parent a6907ad commit ec5d3f5
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 2 deletions.
4 changes: 4 additions & 0 deletions index/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
8 changes: 7 additions & 1 deletion index/server/build-multi-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -52,4 +55,7 @@ else

docker buildx rm index-base-builder

fi
fi

# Remove license from build directory
rm ${buildfolder}/LICENSE
8 changes: 8 additions & 0 deletions index/server/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions oci-registry/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
7 changes: 6 additions & 1 deletion oci-registry/build-multi-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -78,4 +80,7 @@ else
docker manifest push "$DEFAULT_MANIFEST"
docker manifest rm "$DEFAULT_MANIFEST"

fi
fi

# Remove license from build directory
rm ${buildfolder}/LICENSE
6 changes: 6 additions & 0 deletions oci-registry/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions tests/integration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions tests/integration/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/

0 comments on commit ec5d3f5

Please sign in to comment.