minikube/deploy/kicbase/Dockerfile

75 lines
3.3 KiB
Docker
Raw Normal View History

2019-12-23 06:19:52 +00:00
ARG COMMIT_SHA
2020-07-28 20:32:50 +00:00
# using base image created by kind https://github.com/kubernetes-sigs/kind/blob/v0.8.1/images/base/Dockerfile
# which is an ubuntu 20.04 with an entry-point that helps running systemd
2020-02-03 23:31:52 +00:00
# could be changed to any debian that can run systemd
2020-07-28 20:32:50 +00:00
FROM kindest/base:v20200430-2c0eee40 as base
2019-12-23 07:39:44 +00:00
USER root
2020-02-22 21:51:42 +00:00
# specify version of everything explicitly using 'apt-cache policy'
RUN apt-get update && apt-get install -y --no-install-recommends \
2020-07-28 20:38:35 +00:00
lz4 \
gnupg \
sudo \
docker.io \
openssh-server \
dnsutils \
# libglib2.0-0 is required for conmon, which is required for podman
2020-07-28 20:38:35 +00:00
libglib2.0-0 \
# removing kind's crictl config
2020-02-22 21:51:42 +00:00
&& rm /etc/crictl.yaml
2020-04-23 18:05:47 +00:00
# install cri-o based on https://github.com/cri-o/cri-o/commit/96b0c34b31a9fc181e46d7d8e34fb8ee6c4dc4e1#diff-04c6e90faac2675aa89e2176d2eec7d8R128
2020-07-28 20:38:35 +00:00
RUN sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" && \
curl -LO https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_20.04/Release.key && \
2020-02-22 22:07:43 +00:00
apt-key add - < Release.key && apt-get update && \
2020-04-27 17:45:34 +00:00
apt-get install -y --no-install-recommends cri-o-1.17
# install podman
2020-07-28 20:38:35 +00:00
RUN sh -c "echo 'deb https://dl.bintray.com/afbjorklund/podman focal main' > /etc/apt/sources.list.d/podman.list" && \
curl -L https://bintray.com/user/downloadSubjectPublicKey?username=afbjorklund -o afbjorklund-public.key.asc && \
apt-key add - < afbjorklund-public.key.asc && apt-get update && \
2020-07-28 20:38:35 +00:00
apt-get install -y --no-install-recommends podman=1.8.2~2
2020-04-27 17:45:34 +00:00
# install varlink
RUN apt-get install -y --no-install-recommends varlink
2020-07-28 18:10:36 +00:00
COPY entrypoint /usr/local/bin/entrypoint
# automount service
COPY automount/minikube-automount /usr/sbin/minikube-automount
COPY automount/minikube-automount.service /usr/lib/systemd/system/minikube-automount.service
RUN ln -fs /usr/lib/systemd/system/minikube-automount.service \
/etc/systemd/system/multi-user.target.wants/minikube-automount.service
# disable non-docker runtimes by default
2020-02-22 23:41:12 +00:00
RUN systemctl disable containerd && systemctl disable crio && rm /etc/crictl.yaml
2020-02-03 23:31:52 +00:00
# enable docker which is default
RUN systemctl enable docker
2020-01-24 02:24:51 +00:00
# making SSH work for docker container
2020-02-03 23:31:52 +00:00
# based on https://github.com/rastasheep/ubuntu-sshd/blob/master/18.04/Dockerfile
2020-01-24 02:24:51 +00:00
RUN mkdir /var/run/sshd
RUN echo 'root:root' |chpasswd
RUN sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
2020-06-12 19:20:03 +00:00
2020-01-24 02:24:51 +00:00
EXPOSE 22
# create docker user for minikube ssh. to match VM using "docker" as username
2020-02-03 23:31:52 +00:00
RUN adduser --ingroup docker --disabled-password --gecos '' docker
RUN adduser docker sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER docker
RUN mkdir /home/docker/.ssh
USER root
# kind base-image entry-point expects a "kind" folder for product_name,product_uuid
# https://github.com/kubernetes-sigs/kind/blob/master/images/base/files/usr/local/bin/entrypoint
RUN mkdir -p /kind
# Deleting leftovers
RUN apt-get clean -y && rm -rf \
/var/cache/debconf/* \
/var/lib/apt/lists/* \
/var/log/* \
/tmp/* \
/var/tmp/* \
/usr/share/doc/* \
/usr/share/man/* \
/usr/share/local/* \
2020-07-27 20:12:38 +00:00
RUN echo "kic! Build: ${COMMIT_SHA} Time :$(date)" > "/kic.txt"