refactor(docker): update main dockerfile (copy files directly)

Signed-off-by: Maik Ellerbrock <opensource@frapsoft.com>
This commit is contained in:
Maik Ellerbrock 2017-01-22 01:01:53 +01:00
parent dcecae29e9
commit 1745cc16bb
No known key found for this signature in database
GPG key ID: AC6B0B8B492B04CA
3 changed files with 17 additions and 48 deletions

View file

@ -4,29 +4,18 @@ LABEL org.label-schema.name="docker-bench-security" \
org.label-schema.url="https://dockerbench.com" \
org.label-schema.vcs-url="https://github.com/docker/docker-bench-security.git"
ENV VERSION 1.12.6
ENV SHA256 cadc6025c841e034506703a06cf54204e51d0cadfae4bae62628ac648d82efdd
RUN \
apk add --no-cache \
docker \
dumb-init && \
mkdir /usr/local/bin/tests
WORKDIR /usr/bin
COPY ./*.sh /usr/local/bin/
RUN apk update && \
apk upgrade && \
apk --update add coreutils wget ca-certificates && \
wget https://get.docker.com/builds/Linux/x86_64/docker-$VERSION.tgz && \
wget https://get.docker.com/builds/Linux/x86_64/docker-$VERSION.tgz.sha256 && \
sha256sum -c docker-$VERSION.tgz.sha256 && \
echo "$SHA256 docker-$VERSION.tgz" | sha256sum -c - && \
tar -xzvf docker-$VERSION.tgz -C /tmp && \
mv /tmp/docker/docker . && \
chmod u+x docker* && \
rm -rf /tmp/docker* && \
apk del wget ca-certificates && \
rm -rf /var/cache/apk/* docker-$VERSION.tgz docker-$VERSION.tgz.sha256
COPY ./tests/*.sh /usr/local/bin/tests/
RUN mkdir /docker-bench-security
COPY . /docker-bench-security
WORKDIR /usr/local/bin
WORKDIR /docker-bench-security
ENTRYPOINT [ "/usr/bin/dumb-init", "docker-bench-security.sh" ]
ENTRYPOINT ["/bin/sh", "docker-bench-security.sh"]

View file

@ -1,20 +0,0 @@
FROM alpine:3.5
LABEL org.label-schema.name="docker-bench-security" \
org.label-schema.url="https://dockerbench.com" \
org.label-schema.vcs-url="https://github.com/docker/docker-bench-security.git"
RUN \
apk add --no-cache \
docker \
dumb-init \
git && \
git clone https://github.com/docker/docker-bench-security.git /tmp/bench-security && \
cp /tmp/bench-security/*.sh /usr/local/bin && \
cp -R /tmp/bench-security/tests /usr/local/bin && \
rm -rf /tmp/*
WORKDIR /usr/local/bin
ENTRYPOINT [ "/usr/bin/dumb-init", "docker-bench-security.sh" ]

View file

@ -10,13 +10,13 @@
#
# ------------------------------------------------------------------------------
# Setup the paths
this_path=$(dirname "${0}") ## Path of this file including filenamel
myname=$(basename "${this_path}") ## file name of this script.
# Load dependencies
. ${this_path}/output_lib.sh
. ${this_path}/helper_lib.sh
. ./output_lib.sh
. ./helper_lib.sh
# Setup the paths
this_path=$(abspath "$0") ## Path of this file including filenamel
myname=$(basename "${this_path}") ## file name of this script.
export PATH=/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin/
@ -90,9 +90,9 @@ main () {
# List all running containers except docker-bench (use names to improve readability in logs)
containers=$(docker ps | sed '1d' | awk '{print $NF}' | grep -v "$benchcont")
for test in ${this_path}/tests/*.sh
for test in tests/*.sh
do
. "${test}"
. ./"$test"
done
}