Skip to content

Commit

Permalink
added Dockerfile and build.sh from offensive-security/kali-linux-docker
Browse files Browse the repository at this point in the history
  • Loading branch information
0x90 committed Feb 22, 2018
1 parent 56c5972 commit 24e971a
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <steev@kali.org>"
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"]
28 changes: 28 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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!"

0 comments on commit 24e971a

Please sign in to comment.