diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c9cbe98 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM kalilinux/kali-linux-docker +# Metadata params +ARG BUILD_DATE +ARG VERSION +ARG VCS_URL +ARG VCS_REF + +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.vcs-url=$VCS_URL \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.version=$VERSION \ + org.label-schema.name='Kali Linux' \ + org.label-schema.description='Official Kali Linux docker image' \ + org.label-schema.usage='https://www.kali.org/news/official-kali-linux-docker-images/' \ + org.label-schema.url='https://www.kali.org/' \ + org.label-schema.vendor='Offensive Security' \ + org.label-schema.schema-version='1.0' \ + org.label-schema.docker.cmd='docker run --rm kalilinux/kali-linux-docker' \ + org.label-schema.docker.cmd.devel='docker run --rm -ti kalilinux/kali-linux-docker' \ + org.label-schema.docker.debug='docker logs $CONTAINER' \ + io.github.offensive-security.docker.dockerfile="Dockerfile" \ + io.github.offensive-security.license="GPLv3" \ + MAINTAINER="Steev Klimaszewski " +RUN echo "deb http://http.kali.org/kali kali-rolling main contrib non-free" > /etc/apt/sources.list && \ + echo "deb-src http://http.kali.org/kali kali-rolling main contrib non-free" >> /etc/apt/sources.list +ENV DEBIAN_FRONTEND noninteractive +RUN set -x \ + && apt-get -yqq update \ + && apt-get -yqq dist-upgrade \ + && apt-get clean +CMD ["bash"] diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..aa2296f --- /dev/null +++ b/build.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Install dependencies (debbootstrap) +sudo apt-get install -yqq debootstrap curl + +# ----------------------------------------------------------------------------- +# BUILD/LABEL VARIABLES +# ----------------------------------------------------------------------------- +BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") +VERSION="latest" +VCS_URL=$(git config --get remote.origin.url) +VCS_REF=$(git rev-parse --short HEAD) + +# Fetch the latest Kali debootstrap script from git +curl "http://git.kali.org/gitweb/?p=packages/debootstrap.git;a=blob_plain;f=scripts/kali;h=50d7ef5b4e9e905cc6da8655416cdf3ef559911e;hb=refs/heads/kali/master" > kali-debootstrap &&\ +sudo debootstrap kali-rolling ./kali-root http://repo.kali.org/kali ./kali-debootstrap &&\ +sudo tar -C kali-root -c . | sudo docker import - kalilinux/kali-linux-docker &&\ +sudo rm -rf ./kali-root &&\ +TAG=$(sudo docker run -t -i kalilinux/kali-linux-docker awk '{print $NF}' /etc/debian_version | sed 's/\r$//' ) &&\ +echo "Tagging kali with $TAG" &&\ +sudo docker tag kalilinux/kali-linux-docker:$VERSION kalilinux/kali-linux-docker:$TAG &&\ +echo "Labeling kali" &&\ +sudo docker build --squash --rm -t kalilinux/kali-linux-docker:$VERSION \ +--build-arg BUILD_DATE=$BUILD_DATE \ +--build-arg VERSION=$VERSION \ +--build-arg VCS_URL=$VCS_URL \ +--build-arg VCS_REF=$VCS_REF . &&\ +echo "Build OK" || echo "Build failed!"