Skip to content

Commit

Permalink
Updated the Dockerfile to run in an alpine ruby container (#47)
Browse files Browse the repository at this point in the history
* Updated the Dockerfile to run in an alpine ruby container

* Updated the README to have the docker command information

* resolved pr comments

Co-authored-by: John <[email protected]>
  • Loading branch information
jsa5593 and John authored May 22, 2020
1 parent b1267a8 commit ccaa79e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
36 changes: 19 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM registry.access.redhat.com/ubi8/ruby-26
ENV HEIMDALLTOOLS_VERSION 1.3.6
MAINTAINER [email protected]
FROM ruby:alpine as builder

LABEL name="Heimdall Tools" \
vendor="MTIRE" \
version="${HEIMDALLTOOLS_VERSION}" \
Expand All @@ -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} <args>"
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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ccaa79e

Please sign in to comment.