Move custom images out of contrib

This commit is contained in:
bprashanth 2017-01-31 10:19:58 -08:00
parent 3e87a2de40
commit d002ca2f5e
12 changed files with 435 additions and 0 deletions

View file

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

View file

@ -0,0 +1,45 @@
FROM ubuntu:16.04
ENV DEBIAN_FRONTEND=noninteractive
COPY excludes /etc/dpkg/dpkg.cfg.d/excludes
RUN apt-get update \
&& apt-get dist-upgrade -y
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 \
libcap2-bin \
libkmod2 \
libsmartcols1 \
libudev1 \
tzdata
# 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

21
images/ubuntu-slim/Makefile Executable file
View file

@ -0,0 +1,21 @@
all: push
TAG ?= 0.6
PREFIX ?= gcr.io/google_containers/ubuntu-slim
BUILD_IMAGE ?= ubuntu-build
TAR_FILE ?= rootfs.tar
container: clean
docker build --pull -t $(BUILD_IMAGE) -f Dockerfile.build .
docker create --name $(BUILD_IMAGE) $(BUILD_IMAGE)
docker export $(BUILD_IMAGE) > $(TAR_FILE)
docker build --pull -t $(PREFIX):$(TAG) .
push: container
docker push $(PREFIX):$(TAG)
clean:
docker rmi -f $(PREFIX):$(TAG) || true
docker rmi -f $(BUILD_IMAGE) || true
docker rm -f $(BUILD_IMAGE) || true
rm -f $(TAR_FILE)

View file

@ -0,0 +1,22 @@
Small Ubuntu 16.04 docker image
The size of this image is ~56MB (less than half than `ubuntu:16.04).
This is possible by the removal of packages that are not required in a container:
- dmsetup
- e2fsprogs
- init
- initscripts
- libcap2-bin
- libcryptsetup4
- libdevmapper1.02.1
- libkmod2
- libsmartcols1
- libudev1
- mount
- procps
- systemd
- systemd-sysv
- tzdata
- udev
- util-linux

View file

@ -0,0 +1,10 @@
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*

3
images/ubuntu-slim/runlevel Executable file
View file

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