FROM ubuntu:16.04 # Set the version of the gosu command and if needs to be, it can be modified at runtime ENV GOSU_VERSION 1.10 # For building the image in a proxy environment if necessary ARG HTTP_PROXY ARG HTTPS_PROXY ENV HTTP_PROXY ${HTTP_PROXY} ENV HTTPS_PROXY ${HTTPS_PROXY} ENV http_proxy ${HTTP_PROXY} ENV https_proxy ${HTTPS_PROXY} RUN \ # Put all the dependencies into this variable to easily install everything DEPS="wget ca-certificates curl ksh git openjdk-8-jre-headless uuid-runtime netcat cron ssh vim iputils-ping jq" && \ # Run the update before for the package manager to properly fetch install packages apt-get update && \ # Install the recommended dependencies apt-get install -y --no-install-recommends $DEPS && \ # Remove all the cache for the apt package manager rm -rf /var/lib/apt/lists/* && \ # Get the dpkg to properly download and install that version compatible to install GOSU on the image dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" && \ \ # Downloads the gosu command based on the dpkg version and gosu version supplied wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ \ # Use GPG to install the gosu application locally export GNUPGHOME="$(mktemp -d)" && \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 && \ gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu && \ chmod +x /usr/local/bin/gosu; \ \ # Cleanup of the gosu dependencies that are no longer needed rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc ; \ # If this build in a proxy environment, you would need this for chef solo install script if [ ! -z "${HTTP_PROXY}" ]; then echo -e "use_proxy=yes;\nhttp_proxy=${HTTP_PROXY};" >> ~/.wgetrc; fi; \ # Install chef solo only using this install script that is downloaded from opscode curl -k -L https://www.opscode.com/chef/install.sh -o /tmp/chef_install.sh && \ chmod +x /tmp/chef_install.sh && /tmp/chef_install.sh -v 13.6.4 && rm /tmp/chef_install.sh && \ # Create the chef directory for where chef related content will be stored mkdir -p /var/chef ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64