diff --git a/Dockerfile b/Dockerfile index 6bfb6e0..bbd0ba2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ -FROM registry.access.redhat.com/ubi8/ruby-26 -ENV HEIMDALLTOOLS_VERSION 1.3.6 -MAINTAINER rx294@nyu.edu +FROM ruby:alpine as builder + LABEL name="Heimdall Tools" \ vendor="MTIRE" \ version="${HEIMDALLTOOLS_VERSION}" \ @@ -9,22 +8,25 @@ LABEL name="Heimdall Tools" \ description="HeimdallTools supplies several methods to convert output from various tools to \"Heimdall Data Format\"(HDF) format to be viewable in Heimdall" \ docs="https://github.com/mitre/heimdall_tools" \ run="docker run -d --name ${NAME} ${IMAGE} " -USER 0 -RUN groupadd -r heimdall_tools \ -&& useradd -r -g heimdall_tools heimdall_tools \ -&& mkdir -p /opt/app-root/ \ -&& chown -R heimdall_tools.heimdall_tools /opt/app-root/ +RUN mkdir -p /share +RUN apk add --no-cache build-base git-lfs openssl-dev + +COPY . /build +RUN cd /build && \ + bundle install && \ + gem build heimdall_tools.gemspec -o heimdall_tools.gem + -USER heimdall_tools +FROM ruby:alpine -RUN git clone https://github.com/mitre/heimdall_tools /opt/app-root/heimdall_tools \ -&& cd /opt/app-root/heimdall_tools \ -&& bundle install --path /opt/app-root/ \ -&& rm -rf /opt/app-root/heimdall_tools/docs \ -&& rm -rf /opt/app-root/heimdall_tools/sample_jsons +RUN apk add --no-cache build-base -VOLUME /opt/data -WORKDIR /opt/app-root/heimdall_tools +COPY --from=builder /build/heimdall_tools.gem /build/ +RUN gem install build/heimdall_tools.gem + +RUN apk del build-base -ENTRYPOINT ["bundle","exec","./heimdall_tools"] +ENTRYPOINT ["heimdall_tools"] +VOLUME ["/share"] +WORKDIR /share diff --git a/README.md b/README.md index dd8a398..10983a2 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,13 @@ Verify the installed version number: On the Command Line, `heimdall_tools help` will print a listing of all the command with a short description. For detailed help on any command, run `heimdall_tools help [COMMAND]`. Help can also be called with the `-h, --help` flags after any command, like `heimdall_tools fortify_mapper -h`. +For Docker usage, replace the `heimdall_tools` command with the correct Docker command below for your operating system: + +- **On Linux and Mac:** `docker run -it -v$(pwd):/share mitre/heimdall_tools` +- **On Windows CMD:** `docker run -it -v%cd%:/share mitre/heimdall_tools` + +Note that all of the above Docker commands will mount your current directory on the Docker container. Ensure that you have navigated to the directory you intend to convert files in before executing the command. + ## sonarqube_mapper sonarqube_mapper pulls SonarQube results, for the specified project, from the API and outputs in HDF format Json to be viewed on Heimdall