mirror of
https://github.com/docker/docker-bench-security.git
synced 2025-01-19 00:32:34 +01:00
refactor(docker): update main dockerfile (copy files directly)
Signed-off-by: Maik Ellerbrock <opensource@frapsoft.com>
This commit is contained in:
parent
dcecae29e9
commit
1745cc16bb
3 changed files with 17 additions and 48 deletions
29
Dockerfile
29
Dockerfile
|
@ -4,29 +4,18 @@ LABEL org.label-schema.name="docker-bench-security" \
|
||||||
org.label-schema.url="https://dockerbench.com" \
|
org.label-schema.url="https://dockerbench.com" \
|
||||||
org.label-schema.vcs-url="https://github.com/docker/docker-bench-security.git"
|
org.label-schema.vcs-url="https://github.com/docker/docker-bench-security.git"
|
||||||
|
|
||||||
ENV VERSION 1.12.6
|
RUN \
|
||||||
ENV SHA256 cadc6025c841e034506703a06cf54204e51d0cadfae4bae62628ac648d82efdd
|
apk add --no-cache \
|
||||||
|
docker \
|
||||||
|
dumb-init && \
|
||||||
|
mkdir /usr/local/bin/tests
|
||||||
|
|
||||||
WORKDIR /usr/bin
|
COPY ./*.sh /usr/local/bin/
|
||||||
|
|
||||||
RUN apk update && \
|
COPY ./tests/*.sh /usr/local/bin/tests/
|
||||||
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
|
|
||||||
|
|
||||||
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"]
|
|
||||||
|
|
|
@ -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" ]
|
|
||||||
|
|
|
@ -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
|
# Load dependencies
|
||||||
. ${this_path}/output_lib.sh
|
. ./output_lib.sh
|
||||||
. ${this_path}/helper_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/
|
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)
|
# 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")
|
containers=$(docker ps | sed '1d' | awk '{print $NF}' | grep -v "$benchcont")
|
||||||
|
|
||||||
for test in ${this_path}/tests/*.sh
|
for test in tests/*.sh
|
||||||
do
|
do
|
||||||
. "${test}"
|
. ./"$test"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue