Merge pull request #1690 from aledbf/deprecate-ubuntu-slim

Deprecate ubuntu-slim
This commit is contained in:
Manuel Alejandro de Brito Fontes 2017-11-12 10:39:34 -03:00 committed by GitHub
commit 0d2434f87f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 2 additions and 213 deletions

View file

@ -1 +0,0 @@
rootfs.tar

View file

@ -1,5 +0,0 @@
FROM scratch
ADD rootfs.tar /
CMD ["/bin/bash"]

View file

@ -1,57 +0,0 @@
FROM BASEIMAGE
ENV DEBIAN_FRONTEND=noninteractive
CROSS_BUILD_COPY qemu-ARCH-static /usr/bin/
COPY excludes /etc/dpkg/dpkg.cfg.d/excludes
RUN apt-get update \
&& apt-get dist-upgrade -y
# no-op script removes the need for systemd-sysv
COPY runlevel /sbin/runlevel
# hold required packages to avoid breaking the installation of packages
RUN apt-mark hold apt gnupg adduser passwd libsemanage1
# dpkg --get-selections | grep -v deinstall
RUN echo "Yes, do as I say!" | apt-get purge \
e2fslibs \
libcap2-bin \
libkmod2 \
libmount1 \
libncursesw5 \
libprocps4 \
libsmartcols1 \
libudev1 \
ncurses-base \
ncurses-bin \
locales \
tzdata \
systemd \
libsystemd0
# cleanup
RUN apt-get autoremove -y && \
apt-get clean -y && \
tar -czf /usr/share/copyrights.tar.gz /usr/share/common-licenses /usr/share/doc/*/copyright && \
rm -rf \
/usr/share/doc \
/usr/share/man \
/usr/share/info \
/usr/share/locale \
/var/lib/apt/lists/* \
/var/log/* \
/var/cache/debconf/* \
/usr/share/common-licenses* \
~/.bashrc \
/etc/systemd \
/lib/lsb \
/lib/udev \
/usr/lib/x86_64-linux-gnu/gconv/IBM* \
/usr/lib/x86_64-linux-gnu/gconv/EBC* && \
mkdir -p /usr/share/man/man1 /usr/share/man/man2 \
/usr/share/man/man3 /usr/share/man/man4 \
/usr/share/man/man5 /usr/share/man/man6 \
/usr/share/man/man7 /usr/share/man/man8

View file

@ -1,112 +0,0 @@
# Copyright 2017 The Kubernetes Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
TAG ?= 0.14
REGISTRY = quay.io/kubernetes-ingress-controller
ARCH ?= $(shell go env GOARCH)
ALL_ARCH = amd64 arm arm64 ppc64le
QEMUVERSION=v2.9.1
IMGNAME = ubuntu-slim
IMAGE = $(REGISTRY)/$(IMGNAME)
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)
BUILD_IMAGE ?= ubuntu-build
TAR_FILE ?= rootfs.tar
DOCKER ?= gcloud docker --
# Set default base image dynamically for each arch
ifeq ($(ARCH),amd64)
BASEIMAGE?=ubuntu:16.04
endif
ifeq ($(ARCH),arm)
BASEIMAGE?=armhf/ubuntu:16.04
QEMUARCH=arm
endif
ifeq ($(ARCH),arm64)
BASEIMAGE?=aarch64/ubuntu:16.04
QEMUARCH=aarch64
endif
ifeq ($(ARCH),ppc64le)
BASEIMAGE?=ppc64le/ubuntu:16.04
QEMUARCH=ppc64le
endif
ifeq ($(ARCH),s390x)
BASEIMAGE?=s390x/ubuntu:16.04
QEMUARCH=s390x
endif
TEMP_DIR := $(shell mktemp -d)
all: all-container
image-info:
echo -n '{"image":"$(IMAGE)","tag":"$(TAG)"}'
sub-container-%:
$(MAKE) ARCH=$* container
sub-push-%:
$(MAKE) ARCH=$* push
all-container: $(addprefix sub-container-,$(ALL_ARCH))
all-push: $(addprefix sub-push-,$(ALL_ARCH))
container: .container-$(ARCH)
.container-$(ARCH): clean
cp ./* $(TEMP_DIR)
cd $(TEMP_DIR) && sed -i 's|BASEIMAGE|$(BASEIMAGE)|g' Dockerfile.build
cd $(TEMP_DIR) && sed -i "s|ARCH|$(QEMUARCH)|g" Dockerfile.build
ifeq ($(ARCH),amd64)
# When building "normally" for amd64, remove the whole line, it has no part in the amd64 image
cd $(TEMP_DIR) && sed -i "/CROSS_BUILD_/d" Dockerfile.build
else
# When cross-building, only the placeholder "CROSS_BUILD_" should be removed
# Register /usr/bin/qemu-ARCH-static as the handler for ARM binaries in the kernel
$(DOCKER) run --rm --privileged multiarch/qemu-user-static:register --reset
curl -sSL https://github.com/multiarch/qemu-user-static/releases/download/$(QEMUVERSION)/x86_64_qemu-$(QEMUARCH)-static.tar.gz | tar -xz -C $(TEMP_DIR)
cd $(TEMP_DIR) && sed -i "s/CROSS_BUILD_//g" Dockerfile.build
endif
$(DOCKER) build --pull -t $(BUILD_IMAGE) -f $(TEMP_DIR)/Dockerfile.build $(TEMP_DIR)
$(DOCKER) create --name $(BUILD_IMAGE) $(BUILD_IMAGE)
$(DOCKER) export $(BUILD_IMAGE) > $(TAR_FILE)
cp rootfs.tar $(TEMP_DIR)
$(DOCKER) build --pull -t $(MULTI_ARCH_IMG):$(TAG) $(TEMP_DIR)
ifeq ($(ARCH), amd64)
# This is for to maintain the backward compatibility
$(DOCKER) tag $(MULTI_ARCH_IMG):$(TAG) $(IMAGE):$(TAG)
endif
push: .push-$(ARCH)
.push-$(ARCH): .container-$(ARCH)
$(DOCKER) push $(MULTI_ARCH_IMG):$(TAG)
ifeq ($(ARCH),amd64)
$(DOCKER) push $(IMAGE):$(TAG)
endif
clean:
$(DOCKER) rmi -f $(IMAGE):$(TAG) || true
$(DOCKER) rmi -f $(BUILD_IMAGE) || true
$(DOCKER) rm -f $(BUILD_IMAGE) || true
rm -f $(TAR_FILE)
release: all-container all-push
echo "done"

View file

@ -1,26 +1,3 @@
# Deprecated
Small Ubuntu 16.04 docker image
The size of this image is ~44MB (less than half than `ubuntu:16.04).
This is possible by the removal of packages that are not required in a container:
- e2fslibs
- e2fsprogs
- init
- initscripts
- libcap2-bin
- libcryptsetup4
- libdevmapper1.02.1
- libkmod2
- libmount1
- libncursesw5
- libprocps4
- libsmartcols1
- libudev1
- mount
- ncurses-base
- ncurses-bin
- procps
- systemd
- systemd-sysv
- tzdata
- util-linux
Please switch to [debian-base](https://github.com/kubernetes/kubernetes/tree/master/build/debian-base)

View file

@ -1,10 +0,0 @@
path-exclude /usr/share/doc/*
path-include /usr/share/doc/*/copyright
path-exclude /usr/share/man/*
path-exclude /usr/share/groff/*
path-exclude /usr/share/info/*
path-exclude /usr/share/locale/*
path-include /usr/share/locale/en_US*
path-include /usr/share/locale/locale.alias
path-exclude /usr/share/i18n/locales/*
path-include /usr/share/i18n/locales/en_US*

View file

@ -1,3 +0,0 @@
#!/bin/sh
exit 0