Skip to content

Commit

Permalink
Merge pull request #12 from metal-stack/split-images
Browse files Browse the repository at this point in the history
Split into two images (vagrant), save almost 1GB for our most used image and updates
  • Loading branch information
Gerrit91 authored Nov 26, 2020
2 parents b456ea1 + 01b170a commit 80ab644
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 28 deletions.
53 changes: 25 additions & 28 deletions metal-deployment/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,46 @@
FROM python:3.8-buster
FROM debian:10

ENV VERSION_ANSIBLE=2.9.13 \
ENV VERSION_ANSIBLE=2.9.15 \
VERSION_CT=0.9.0 \
VERSION_HELM=3.4.0 \
VERSION_STERN=1.11.0 \
VERSION_VAGRANT=2.2.9

# vagrant is required for running the vagrant dynamic inventory script from within the container...
ARG VAGRANT_PACKAGE_URL=https://releases.hashicorp.com/vagrant/${VERSION_VAGRANT}/vagrant_${VERSION_VAGRANT}_x86_64.deb
VERSION_HELM=3.4.0

RUN set -x \
&& export CLOUD_SDK_REPO="cloud-sdk-buster" \
&& echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \
&& curl -f https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
&& apt-get update \
&& apt-get install --yes --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
google-cloud-sdk \
software-properties-common \
connect-proxy \
libvirt-dev \
ruby-dev \
rsync \
yamllint \
&& curl -f https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
&& curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] http://packages.cloud.google.com/apt cloud-sdk-buster main" \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian buster stable" \
&& apt-get update \
&& apt-get install --yes --no-install-recommends docker-ce \
&& apt-get install --yes --no-install-recommends \
connect-proxy \
docker-ce \
git \
google-cloud-sdk \
make \
openssh-client \
python3 \
python3-pip \
python3-setuptools \
python3-wheel \
rsync \
yamllint \
&& ln -s /usr/bin/pip3 /usr/bin/pip \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& ln -s /usr/bin/python3-config /usr/bin/python-config \
&& ln -s /usr/bin/python3-doc /usr/bin/python-doc \
&& curl -fsSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash -s -- --version "v${VERSION_HELM}" \
&& pip install --upgrade pip \
&& pip install ansible==${VERSION_ANSIBLE} Jinja2==2.11.1 netaddr==0.7.19 humanfriendly==8.1 openshift==0.11.2 paramiko==2.7.1 \
&& curl -fo vagrant.deb $VAGRANT_PACKAGE_URL \
&& dpkg -i vagrant.deb \
&& rm -f vagrant.deb \
&& vagrant plugin install vagrant-libvirt \
&& curl -Lo stern https://github.com/wercker/stern/releases/download/${VERSION_STERN}/stern_linux_amd64 \
&& chmod +x stern \
&& mv stern /usr/local/bin/ \
&& pip3 install ansible==${VERSION_ANSIBLE} Jinja2==2.11.1 netaddr==0.7.19 humanfriendly==8.1 openshift==0.11.2 paramiko==2.7.1 \
&& curl -Lo ct https://github.com/coreos/container-linux-config-transpiler/releases/download/v${VERSION_CT}/ct-v${VERSION_CT}-x86_64-unknown-linux-gnu \
&& chmod +x ct \
&& mv ct /usr/local/bin/ \
&& curl -fsSL https://dl.minio.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mc \
&& chmod +x /usr/local/bin/mc
&& chmod +x /usr/local/bin/mc \
&& rm -rf /var/cache/apt/* /tmp/*

ENTRYPOINT []
22 changes: 22 additions & 0 deletions metal-deployment/base/Dockerfile.withvagrant
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ARG BASE_VERSION
FROM ghcr.io/metal-stack/metal-deployment-base:${BASE_VERSION}

ENV VERSION_VAGRANT=2.2.14

# vagrant is required for running the vagrant dynamic inventory script from within the container...
ARG VAGRANT_PACKAGE_URL=https://releases.hashicorp.com/vagrant/${VERSION_VAGRANT}/vagrant_${VERSION_VAGRANT}_x86_64.deb

RUN set -x \
&& apt update \
&& apt install --yes \
gcc \
libvirt-dev \
make \
ruby-dev \
ruby-libvirt \
&& curl -fo vagrant.deb $VAGRANT_PACKAGE_URL \
&& dpkg -i vagrant.deb \
&& rm -f vagrant.deb \
&& vagrant plugin install vagrant-libvirt

ENTRYPOINT []
2 changes: 2 additions & 0 deletions metal-deployment/base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ DOCKER_TAG := $(or ${GITHUB_TAG_NAME}, latest)
.PHONY: dockerimage
dockerimage:
docker build -t ghcr.io/metal-stack/metal-deployment-base:${DOCKER_TAG} .
docker build --build-arg BASE_VERSION=${DOCKER_TAG} -t ghcr.io/metal-stack/metal-deployment-base:${DOCKER_TAG}-vagrant . -f Dockerfile.withvagrant

.PHONY: dockerpush
dockerpush:
docker push ghcr.io/metal-stack/metal-deployment-base:${DOCKER_TAG}
docker push ghcr.io/metal-stack/metal-deployment-base:${DOCKER_TAG}-vagrant

0 comments on commit 80ab644

Please sign in to comment.