Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix skopeo build in Docker image #326

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions imagegw/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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 [ ]

3 changes: 2 additions & 1 deletion imagegw/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions imagegw/oci-image-tool-wrapper
Original file line number Diff line number Diff line change
@@ -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

3 changes: 1 addition & 2 deletions imagegw/shifter_imagegw/dockerv2_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down