From e10fad9ea8ab2bf5f1a8971c4e5ea4263fae90b2 Mon Sep 17 00:00:00 2001 From: blacktop Date: Mon, 25 Jul 2016 21:24:19 -0600 Subject: [PATCH] fix entry-point --- Dockerfile | 36 +++++------------------------------- Dockerfile.dev | 36 +++++------------------------------- README.md | 2 +- docker-entrypoint.sh | 33 ++++++++++++++++----------------- 4 files changed, 27 insertions(+), 80 deletions(-) mode change 100644 => 100755 docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile index b5dbccf..865a49e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,38 +1,14 @@ -FROM gliderlabs/alpine +FROM malice/alpine MAINTAINER blacktop, https://github.com/blacktop -# This is the release of https://github.com/hashicorp/docker-base to pull in order -# to provide HashiCorp-built versions of basic utilities like dumb-init and gosu. -ENV DOCKER_BASE_VERSION 0.0.4 -ENV DBASE_URL releases.hashicorp.com/docker-base - -# Create a malice user and group first so the IDs get set the same way, even as -# the rest of this may change over time. -RUN addgroup malice && \ - adduser -S -G malice malice - -COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh COPY . /go/src/github.com/maliceio/malice-virustotal RUN apk-install ca-certificates -RUN apk-install -t build-deps go git mercurial gnupg openssl \ +RUN apk-install -t build-deps go git mercurial \ && set -x \ - && echo "Install hashicorp/docker-base..." \ - && gpg --recv-keys 91A6E7F85D05C65630BEF18951852D87348FFC4C \ - && mkdir -p /tmp/build \ - && cd /tmp/build \ - && wget https://${DBASE_URL}/${DOCKER_BASE_VERSION}/docker-base_${DOCKER_BASE_VERSION}_linux_amd64.zip \ - && wget https://${DBASE_URL}/${DOCKER_BASE_VERSION}/docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS \ - && wget https://${DBASE_URL}/${DOCKER_BASE_VERSION}/docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS.sig \ - && gpg --batch --verify docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS.sig docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS \ - && grep ${DOCKER_BASE_VERSION}_linux_amd64.zip docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS | sha256sum -c \ - && unzip docker-base_${DOCKER_BASE_VERSION}_linux_amd64.zip \ - && cp bin/gosu bin/dumb-init /bin \ - && mkdir /malware \ - && chown -R malice:malice /malware \ - && chmod +x /usr/local/bin/docker-entrypoint.sh \ - && echo "Building info Go binary..." \ + && echo "Building virustotal Go binary..." \ && cd /go/src/github.com/maliceio/malice-virustotal \ + && mv docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh \ && export GOPATH=/go \ && go version \ && go get \ @@ -44,6 +20,4 @@ WORKDIR /malware ENTRYPOINT ["docker-entrypoint.sh"] -# ENTRYPOINT ["/bin/virustotal"] - -CMD ["virustotal", "--help"] +CMD ["--help"] diff --git a/Dockerfile.dev b/Dockerfile.dev index b5dbccf..865a49e 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,38 +1,14 @@ -FROM gliderlabs/alpine +FROM malice/alpine MAINTAINER blacktop, https://github.com/blacktop -# This is the release of https://github.com/hashicorp/docker-base to pull in order -# to provide HashiCorp-built versions of basic utilities like dumb-init and gosu. -ENV DOCKER_BASE_VERSION 0.0.4 -ENV DBASE_URL releases.hashicorp.com/docker-base - -# Create a malice user and group first so the IDs get set the same way, even as -# the rest of this may change over time. -RUN addgroup malice && \ - adduser -S -G malice malice - -COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh COPY . /go/src/github.com/maliceio/malice-virustotal RUN apk-install ca-certificates -RUN apk-install -t build-deps go git mercurial gnupg openssl \ +RUN apk-install -t build-deps go git mercurial \ && set -x \ - && echo "Install hashicorp/docker-base..." \ - && gpg --recv-keys 91A6E7F85D05C65630BEF18951852D87348FFC4C \ - && mkdir -p /tmp/build \ - && cd /tmp/build \ - && wget https://${DBASE_URL}/${DOCKER_BASE_VERSION}/docker-base_${DOCKER_BASE_VERSION}_linux_amd64.zip \ - && wget https://${DBASE_URL}/${DOCKER_BASE_VERSION}/docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS \ - && wget https://${DBASE_URL}/${DOCKER_BASE_VERSION}/docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS.sig \ - && gpg --batch --verify docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS.sig docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS \ - && grep ${DOCKER_BASE_VERSION}_linux_amd64.zip docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS | sha256sum -c \ - && unzip docker-base_${DOCKER_BASE_VERSION}_linux_amd64.zip \ - && cp bin/gosu bin/dumb-init /bin \ - && mkdir /malware \ - && chown -R malice:malice /malware \ - && chmod +x /usr/local/bin/docker-entrypoint.sh \ - && echo "Building info Go binary..." \ + && echo "Building virustotal Go binary..." \ && cd /go/src/github.com/maliceio/malice-virustotal \ + && mv docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh \ && export GOPATH=/go \ && go version \ && go get \ @@ -44,6 +20,4 @@ WORKDIR /malware ENTRYPOINT ["docker-entrypoint.sh"] -# ENTRYPOINT ["/bin/virustotal"] - -CMD ["virustotal", "--help"] +CMD ["--help"] diff --git a/README.md b/README.md index cbfadad..8174fe5 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ malice-virustotal ================= -[![Circle CI](https://circleci.com/gh/maliceio/malice-virustotal.png?style=shield)](https://circleci.com/gh/maliceio/malice-virustotal) [![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org) [![Docker Stars](https://img.shields.io/docker/stars/malice/virustotal.svg)](https://hub.docker.com/r/malice/virustotal/) [![Docker Pulls](https://img.shields.io/docker/pulls/malice/virustotal.svg)](https://hub.docker.com/r/malice/virustotal/) [![Docker Image](https://img.shields.io/badge/docker image-21.53 MB-blue.svg)](https://hub.docker.com/r/malice/virustotal/) +[![Circle CI](https://circleci.com/gh/maliceio/malice-virustotal.png?style=shield)](https://circleci.com/gh/maliceio/malice-virustotal) [![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org) [![Docker Stars](https://img.shields.io/docker/stars/malice/virustotal.svg)](https://hub.docker.com/r/malice/virustotal/) [![Docker Pulls](https://img.shields.io/docker/pulls/malice/virustotal.svg)](https://hub.docker.com/r/malice/virustotal/) [![Docker Image](https://img.shields.io/badge/docker image-21.52 MB-blue.svg)](https://hub.docker.com/r/malice/virustotal/) Malice VirusTotal Plugin diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh old mode 100644 new mode 100755 index 8bd113b..56cad94 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -12,26 +12,25 @@ if [ "${1:0:1}" = '-' ]; then set -- virustotal "$@" fi -# # Look for Vault subcommands. -# if [ "$1" = 'server' ]; then -# shift -# set -- vault server \ -# -config="$VAULT_CONFIG_DIR" \ -# -dev-root-token-id="$VAULT_DEV_ROOT_TOKEN_ID" \ -# -dev-listen-address="$VAULT_DEV_LISTEN_ADDRESS" \ -# "$@" -# elif [ "$1" = 'version' ]; then -# # This needs a special case because there's no help output. -# set -- vault "$@" -# elif vault --help "$1" 2>&1 | grep -q "vault $1"; then -# # We can't use the return code to check for the existence of a subcommand, so -# # we have to use grep to look for a pattern in the help output. -# set -- vault "$@" -# fi +# Look for virustotal subcommands. +if [ "$1" = 'lookup' ]; then + shift + set -- virustotal lookup "$@" +elif [ "$1" = 'scan' ]; then + shift + set -- virustotal scan "$@" +elif [ "$1" = 'version' ]; then + # This needs a special case because there's no help output. + set -- virustotal "$@" +elif virustotal --help "$1" 2>&1 | grep -q "virustotal $1"; then + # We can't use the return code to check for the existence of a subcommand, so + # we have to use grep to look for a pattern in the help output. + set -- virustotal "$@" +fi # If we are running virustotal, make sure it executes as the proper user. if [ "$1" = 'virustotal' ]; then - set -- gosu malice virustotal "$@" + set -- gosu malice "$@" fi exec "$@"