Skip to content

Instantly share code, notes, and snippets.

@leoh0
Created August 22, 2017 05:26
Show Gist options
  • Select an option

  • Save leoh0/9e78f0ace63d19b84c22bec403c03d95 to your computer and use it in GitHub Desktop.

Select an option

Save leoh0/9e78f0ace63d19b84c22bec403c03d95 to your computer and use it in GitHub Desktop.
docker file viewer
$ vdoc 4c66d3b6d4fa
ADD file:9c48682ff75c756544d4491472081a078edf5dd0bb5038d1cb850a1f9c480e3e /
CMD ["bash"]
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl wget && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update && \
apt-get install -y --no-install-recommends bzr git mercurial openssh-client subversion procps && \
rm -rf /var/lib/apt/lists/*
RUN set -ex; \
apt-get update; \
apt-get install -y --no-install-recommends autoconf automake bzip2 file g++ gcc imagemagick libbz2-dev libc6-dev libcurl4-openssl-dev libdb-dev libevent-dev libffi-dev libgdbm-dev libgeoip-dev libglib2.0-dev libjpeg-dev libkrb5-dev liblzma-dev libmagickcore-dev libmagickwand-dev libncurses-dev libpng-dev libpq-dev libreadline-dev libsqlite3-dev libssl-dev libtool libwebp-dev libxml2-dev libxslt-dev libyaml-dev make patch xz-utils zlib1g-dev $( if apt-cache show 'default-libmysqlclient-dev' 2>/dev/null | grep -q '^Version:'; \
then echo 'default-libmysqlclient-dev'; \
else echo 'libmysqlclient-dev'; \
fi ) ; \
rm -rf /var/lib/apt/lists/*
ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV LANG=C.UTF-8
RUN apt-get update && \
apt-get install -y --no-install-recommends tcl tk && \
rm -rf /var/lib/apt/lists/*
ENV GPG_KEY=C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
ENV PYTHON_VERSION=2.7.13
RUN set -ex && \
buildDeps=' dpkg-dev tcl-dev tk-dev ' && \
apt-get update && \
apt-get install -y $buildDeps --no-install-recommends && \
rm -rf /var/lib/apt/lists/* && \
wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" && \
wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" && \
export GNUPGHOME="$(mktemp -d)" && \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" && \
gpg --batch --verify python.tar.xz.asc python.tar.xz && \
rm -rf "$GNUPGHOME" python.tar.xz.asc && \
mkdir -p /usr/src/python && \
tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz && \
rm python.tar.xz && \
cd /usr/src/python && \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" && \
./configure --build="$gnuArch" --enable-shared --enable-unicode=ucs4 && \
make -j "$(nproc)" && \
make install && \
ldconfig && \
apt-get purge -y --auto-remove $buildDeps && \
find /usr/local -depth \( \( -type d -a -name test -o -name tests \) -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \) -exec rm -rf '{}' + && \
rm -rf /usr/src/python
ENV PYTHON_PIP_VERSION=9.0.1
RUN set -ex; \
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
python get-pip.py --disable-pip-version-check --no-cache-dir "pip==$PYTHON_PIP_VERSION" ; \
pip --version; \
find /usr/local -depth \( \( -type d -a -name test -o -name tests \) -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \) -exec rm -rf '{}' +; \
rm -f get-pip.py
RUN pip install --no-cache-dir virtualenv
CMD ["python2"]
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ONBUILD COPY requirements.txt /usr/src/app/
ONBUILD RUN pip install --no-cache-dir -r requirements.txt
ONBUILD COPY . /usr/src/app
COPY file:50ebb131290897803836f13d8d078591007a18f611679dfd71a3f25c85bcf6fd /usr/src/app/
RUN pip install --no-cache-dir -r requirements.txt
COPY dir:a17b12d37a377b7f38075b7bf68e6a4a865fe95889ae9220b3e74ed9a3846bf4 /usr/src/app
vdoc() {
docker history $1 --no-trunc --human=false | \
/usr/bin/sed '1d' | \
/usr/bin/awk '{for(i=3; i<NF; i++) printf "%s",$i OFS; if(NF) printf ORS ORS}' | \
/usr/bin/tail -r | \
/usr/bin/sed 's/^\/bin\/sh -c #(nop) //g;s/^\/bin\/sh -c/RUN/g' | \
/usr/bin/awk '/^RUN /{ gsub(/ \&\& /, "&\\ \n "); print };!/^RUN /{ print }' | \
/usr/bin/awk '/^RUN /{ gsub(/;/, "; \\ \n "); print };!/^RUN /{ print }' | \
/usr/bin/sed 's/^COPY \(.*\) in \(.*\)$/COPY \1 \2/g;s/^ADD \(.*\) in \(.*\)$/ADD \1 \2/g'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment