diff --git a/imagegw/Dockerfile b/imagegw/Dockerfile index ee558e8d..be278336 100644 --- a/imagegw/Dockerfile +++ b/imagegw/Dockerfile @@ -15,8 +15,20 @@ RUN \ make && make install # Need newer version of skopeo then what is available from kubic -FROM debian:sid as skopeo -RUN apt-get -y update && apt-get -y install skopeo +#FROM debian:sid as skopeo +#RUN apt-get -y update && apt-get -y install skopeo + +FROM debian:bullseye as skopeo +RUN \ + apt-get -y update && \ + apt-get -y install golang wget go-md2man git make libgpgme-dev libdevmapper-dev + +RUN \ + git clone https://github.com/containers/skopeo $GOPATH/src/github.com/containers/skopeo && \ + cd $GOPATH/src/github.com/containers/skopeo && \ + git checkout v1.4.1 && make bin/skopeo && \ + DISABLE_DOCS=1 make + FROM python:3.8-slim @@ -26,8 +38,9 @@ RUN apt-get -y update && apt-get -y install squashfs-tools munge libassuan0 libg RUN mkdir /var/run/munge && chown munge /var/run/munge COPY --from=tools /usr/bin/umoci /usr/bin/oci-image-tool /usr/bin/ -COPY --from=skopeo /usr/bin/skopeo /usr/bin/ -COPY --from=skopeo /etc/containers/ /etc/containers/ + +RUN apt-get -y install skopeo +COPY --from=skopeo /src/github.com/containers/skopeo/bin/skopeo /usr/bin/ WORKDIR /usr/src/app @@ -41,6 +54,13 @@ RUN echo "CONFIG_PATH='/config'" >> /usr/src/app/shifter_imagegw/__init__.py ENV PYTHONPATH=/usr/src/app/ +RUN cp /usr/src/app/oci-image-tool-wrapper /usr/local/bin/oci-image-tool-wrapper + +# Test that the tools work +RUN \ + skopeo && umoci && /usr/bin/oci-image-tool + + ENTRYPOINT [ "./entrypoint.sh" ] CMD [ ] diff --git a/imagegw/Makefile.am b/imagegw/Makefile.am index 8f41595a..765400ed 100644 --- a/imagegw/Makefile.am +++ b/imagegw/Makefile.am @@ -2,7 +2,8 @@ SUBDIRS = shifter_imagegw dist_pkglibexec_SCRIPTS = imagecli.py \ imagegwapi.py \ - sitecustomize.py + oci-image-tool-wrapper \ + sitecustomize.py dist_sysconf_DATA = imagemanager.json.example diff --git a/imagegw/oci-image-tool-wrapper b/imagegw/oci-image-tool-wrapper new file mode 100755 index 00000000..b80fbab2 --- /dev/null +++ b/imagegw/oci-image-tool-wrapper @@ -0,0 +1,8 @@ +#!/bin/bash + +# Extract the proper digest +D=$(cat $1/index.json|python -mjson.tool|grep -A1 application/vnd.oci.image.manifest.v1+json|grep dig|sed 's/.* .//'|sed 's/".*//') + +# Call oci-image-tool on just that digest +exec /usr/bin/oci-image-tool validate -type image -ref digest=${D} $1 + diff --git a/imagegw/shifter_imagegw/dockerv2_ext.py b/imagegw/shifter_imagegw/dockerv2_ext.py index aa2ccb91..8eadc553 100644 --- a/imagegw/shifter_imagegw/dockerv2_ext.py +++ b/imagegw/shifter_imagegw/dockerv2_ext.py @@ -131,8 +131,7 @@ def _validate(self, idir): Validate image pull """ self.log("PULLING", 'Validating Image') - cmd = ['oci-image-tool', 'validate', '--type', - 'image', idir] + cmd = ['oci-image-tool-wrapper', idir] process = Popen(cmd, stdout=PIPE) stdout = process.communicate()[0] if process.returncode: