Merge pull request #3724 from Jakob-Naucke/kata-deploy-s390x

kata-deploy: Simplify Dockerfile and support s390x
This commit is contained in:
GabyCT 2022-02-23 11:38:01 -06:00 committed by GitHub
commit 7da7e0a8f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,27 +1,10 @@
# Copyright Intel Corporation. # Copyright Intel Corporation, 2022 IBM Corp.
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
FROM registry.centos.org/centos:7 AS base # Specify alternative base image, e.g. clefos for s390x
ARG IMAGE
ENV container docker FROM ${IMAGE:-registry.centos.org/centos}:7
RUN (cd /lib/systemd/system/sysinit.target.wants/ && for i in *; do [ "$i" = systemd-tmpfiles-setup.service ] || rm -f "$i"; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*; \
rm -f /etc/systemd/system/*.wants/*; \
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*; \
rm -f /lib/systemd/system/anaconda.target.wants/*;
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]
FROM base
ARG KUBE_ARCH=amd64
ARG KATA_ARTIFACTS=./kata-static.tar.xz ARG KATA_ARTIFACTS=./kata-static.tar.xz
ARG DESTINATION=/opt/kata-artifacts ARG DESTINATION=/opt/kata-artifacts
@ -29,17 +12,18 @@ COPY ${KATA_ARTIFACTS} ${WORKDIR}
RUN \ RUN \
yum -y update && \ yum -y update && \
yum install -y epel-release && \ yum -y install xz && \
yum install -y bzip2 jq && \
yum clean all && \ yum clean all && \
mkdir -p ${DESTINATION} && \ mkdir -p ${DESTINATION} && \
tar xvf ${KATA_ARTIFACTS} -C ${DESTINATION}/ && \ tar xvf ${KATA_ARTIFACTS} -C ${DESTINATION}
chown -R root:root ${DESTINATION}/
# hadolint will deny echo -e, heredocs don't work in Dockerfiles, shell substitution doesn't work with $'...'
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" && \ echo "[kubernetes]" >> /etc/yum.repos.d/kubernetes.repo && \
chmod +x /bin/kubectl echo "name=Kubernetes" >> /etc/yum.repos.d/kubernetes.repo && \
echo "baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-$(uname -m)" >> /etc/yum.repos.d/kubernetes.repo && \
echo "gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg" >> /etc/yum.repos.d/kubernetes.repo && \
yum -y install kubectl && \
yum clean all
COPY scripts ${DESTINATION}/scripts COPY scripts ${DESTINATION}/scripts
RUN \
ln -s ${DESTINATION}/scripts/kata-deploy.sh /usr/bin/kata-deploy