kata-deploy: look for kata artifacts locally

When building the kata-deploy images before, we would look to pull the
latest artifacts from the release URL.

It would be better to allow the user to pull from this URL, or to create
the artifacts locally, and pass the location of this tar.xz to the build
process.

Instead of providing KATA_VER, builders should provide KATA_ARTIFACTS,
which is the filename that is assumed to be located within the docker
build path.

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
This commit is contained in:
Eric Ernst 2019-10-16 12:24:01 -07:00
parent dc8fe05654
commit 4f89e97e5e

View File

@ -1,24 +1,22 @@
FROM centos/systemd FROM centos/systemd
ARG KATA_VER
ARG ARCH=x86_64
ARG KUBE_ARCH=amd64 ARG KUBE_ARCH=amd64
ARG KATA_URL=https://github.com/kata-containers/runtime/releases/download/${KATA_VER} ARG KATA_ARTIFACTS=./kata-static.tar.xz
ARG KATA_FILE=kata-static-${KATA_VER}-${ARCH}.tar.xz ARG DESTINATION=/opt/kata-artifacts
COPY ${KATA_ARTIFACTS} .
RUN \ RUN \
yum install -y epel-release && \ yum install -y epel-release && \
yum install -y bzip2 jq && \ yum install -y bzip2 jq && \
curl -sOL ${KATA_URL}/${KATA_FILE} && \ mkdir -p ${DESTINATION} && \
mkdir -p /opt/kata-artifacts && \ tar xvf ${KATA_ARTIFACTS} -C ${DESTINATION}/ && \
tar xvf ${KATA_FILE} -C /opt/kata-artifacts/ && \ chown -R root:root ${DESTINATION}/
chown -R root:root /opt/kata-artifacts/ && \
rm ${KATA_FILE}
RUN \ RUN \
curl -Lso /bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/${KUBE_ARCH}/kubectl && \ curl -Lso /bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/${KUBE_ARCH}/kubectl && \
chmod +x /bin/kubectl chmod +x /bin/kubectl
COPY scripts /opt/kata-artifacts/scripts COPY scripts ${DESTINATION}/scripts
RUN \ RUN \
ln -s /opt/kata-artifacts/scripts/kata-deploy-docker.sh /usr/bin/kata-deploy-docker && \ ln -s ${DESTINATION}/scripts/kata-deploy-docker.sh /usr/bin/kata-deploy-docker && \
ln -s /opt/kata-artifacts/scripts/kata-deploy.sh /usr/bin/kata-deploy ln -s ${DESTINATION}/scripts/kata-deploy.sh /usr/bin/kata-deploy