Skip to content

Commit

Permalink
fix entry-point
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed Jul 26, 2016
1 parent bc23777 commit e10fad9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 80 deletions.
36 changes: 5 additions & 31 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -44,6 +20,4 @@ WORKDIR /malware

ENTRYPOINT ["docker-entrypoint.sh"]

# ENTRYPOINT ["/bin/virustotal"]

CMD ["virustotal", "--help"]
CMD ["--help"]
36 changes: 5 additions & 31 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -44,6 +20,4 @@ WORKDIR /malware

ENTRYPOINT ["docker-entrypoint.sh"]

# ENTRYPOINT ["/bin/virustotal"]

CMD ["virustotal", "--help"]
CMD ["--help"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
33 changes: 16 additions & 17 deletions docker-entrypoint.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"

0 comments on commit e10fad9

Please sign in to comment.