Skip to content

Commit dcd68f7

Browse files
add license to container images (#259)
Signed-off-by: Michael Valdron <[email protected]>
1 parent a6907ad commit dcd68f7

File tree

8 files changed

+47
-2
lines changed

8 files changed

+47
-2
lines changed

Diff for: index/server/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ RUN set -x ; \
4040
# Modify the permissions on the necessary files to allow the container to properly run as a non-root UID
4141
RUN mkdir -p /www/data && chmod -R g+rwx /www/data
4242

43+
# Add license
44+
RUN mkdir -p /licenses
45+
COPY LICENSE /licenses
46+
4347
# disable http/2 on the index server by default
4448
ARG ENABLE_HTTP2=false
4549
ENV ENABLE_HTTP2=${ENABLE_HTTP2}

Diff for: index/server/build-multi-arch.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ PLATFORMS="linux/amd64,linux/arm64"
3030
# Generate OpenAPI endpoint and type definitions
3131
bash ${buildfolder}/codegen.sh
3232

33+
# Copy license to include in image build
34+
cp ${buildfolder}/../../LICENSE ${buildfolder}/LICENSE
35+
3336
if [ ${podman} == true ]; then
3437
echo "Executing with podman"
3538

@@ -52,4 +55,7 @@ else
5255

5356
docker buildx rm index-base-builder
5457

55-
fi
58+
fi
59+
60+
# Remove license from build directory
61+
rm ${buildfolder}/LICENSE

Diff for: index/server/build.sh

+8
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ echo "RUNNING: bash ${buildfolders}/codegen.sh"
4141
# Generate OpenAPI endpoint and type definitions
4242
bash ${buildfolder}/codegen.sh
4343

44+
echo "RUNNING: cp ${buildfolder}/../../LICENSE ${buildfolder}/LICENSE"
45+
# Copy license to include in image build
46+
cp ${buildfolder}/../../LICENSE ${buildfolder}/LICENSE
47+
4448
echo "RUNNING: docker build -t devfile-index-base:latest --platform ${arch} --build-arg ENABLE_HTTP2=${ENABLE_HTTP2} $buildfolder"
4549
# Build the index server
4650
docker build -t devfile-index-base:latest --platform "${arch}" --build-arg ENABLE_HTTP2=${ENABLE_HTTP2} $buildfolder
51+
52+
echo "RUNNING: rm ${buildfolder}/LICENSE"
53+
# Remove license from build directory
54+
rm ${buildfolder}/LICENSE

Diff for: oci-registry/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ RUN microdnf update -y && rm -rf /var/cache/yum && microdnf install ca-certifica
2121
RUN set -x ; \
2222
adduser registry -u 1001 -G root && exit 0
2323

24+
# Copy OCI registry binary from container image
2425
COPY --from=registry --chown=registry:0 /bin/registry /bin/registry
26+
27+
# Add license
28+
RUN mkdir -p /licenses
29+
COPY LICENSE /licenses
30+
2531
USER 1001
2632
EXPOSE 5000
2733
ENTRYPOINT ["registry"]

Diff for: oci-registry/build-multi-arch.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ function engine-handler {
4848
done
4949
}
5050

51+
# Copy license to include in image build
52+
cp ${buildfolder}/../LICENSE ${buildfolder}/LICENSE
5153

5254
if [ ${podman} == true ]; then
5355
echo "Executing with podman"
@@ -78,4 +80,7 @@ else
7880
docker manifest push "$DEFAULT_MANIFEST"
7981
docker manifest rm "$DEFAULT_MANIFEST"
8082

81-
fi
83+
fi
84+
85+
# Remove license from build directory
86+
rm ${buildfolder}/LICENSE

Diff for: oci-registry/build.sh

+6
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,10 @@ fi
3232
# set podman alias if necessary
3333
. ${buildfolder}/../setenv.sh
3434

35+
# Copy license to include in image build
36+
cp ${buildfolder}/../LICENSE ${buildfolder}/LICENSE
37+
3538
docker build -t oci-registry:next --platform "${arch}" "$buildfolder"
39+
40+
# Remove license from build directory
41+
rm ${buildfolder}/LICENSE

Diff for: tests/integration/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ RUN cd /registry-test/registry-library && ./build.sh && cp /registry-test/regist
2424
# Build the test binary
2525
RUN /registry-test/build.sh
2626

27+
# Add license
28+
RUN mkdir -p /licenses
29+
COPY LICENSE /licenses
30+
2731
CMD /registry-test/devfile-registry-integration

Diff for: tests/integration/docker-build.sh

+6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@
2020
# Get the registry-library
2121
cp -rf ../../registry-library ./
2222

23+
# Copy license to include in image build
24+
cp ../../LICENSE LICENSE
25+
2326
# Build the container image
2427
docker build -t devfile-registry-integration ./
2528

29+
# Remove license from build directory
30+
rm LICENSE
31+
2632
rm -rf ./registry-library/

0 commit comments

Comments
 (0)