Skip to content

Commit 4077f02

Browse files
authored
Ruby to docker (#181)
* Start of dockerfile with it installing dependecies from the gemspec file * Docker container runs inspec_tools * locally built and installed inspec_tools.gemspec and updated README.md * Created multi-stage build dockerfile and updated README.md * Updated README.md commands and changed apk add git-lfs in Dockerfile * Changed --update to --no-cache * updated Dockerfile and README.md * Added the accepting of the chef_lisence into the Dockerfile and updated the commands on the README.md * Combined Command line and Docker usage sections * Fixed command inside README.md * Update Docker execution instructions * On Windows, only a single % is required around variables Authored-by: John <atwoodj@mitre.org>
1 parent 6d2d0ef commit 4077f02

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM ruby:alpine AS builder
2+
3+
RUN mkdir -p /share
4+
RUN apk add --no-cache build-base git-lfs
5+
6+
COPY . /build
7+
RUN cd /build && \
8+
bundle install && \
9+
gem build inspec_tools.gemspec -o inspec_tools.gem
10+
11+
12+
FROM ruby:alpine
13+
14+
ENV CHEF_LICENSE=accept
15+
RUN apk add --no-cache build-base
16+
17+
COPY --from=builder /build/inspec_tools.gem /build/
18+
RUN gem install build/inspec_tools.gem
19+
20+
RUN apk del build-base
21+
22+
ENTRYPOINT ["inspec_tools"]
23+
VOLUME ["/share"]
24+
WORKDIR /share

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ xccdf_results = tool.to_xccdf(attribs_json)
6161
On the Command Line, `inspec_tools help` will print a listing of all the command with a short description.
6262
For detailed help on any command, run `inspec_tools help [COMMAND]`. Help can also be called with the `-h, --help` flags after any command, like `inspec_tools xccdf2inspec -h`.
6363

64+
For Docker usage, replace the `inspec_tools` command with the correct Docker command below for your operating system:
65+
66+
- **On Linux and Mac**: `docker run -it -v$(pwd):/share mitre/inspec_tools`
67+
- **On Windows CMD**: `docker run -it -v%cd%:/share mitre/inspec_tools`
68+
69+
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.
70+
6471
### generate_map
6572

6673
This command will generate a `mapping.xml` file that can be passed in to the `csv2inspec` command with the `--m` option.

0 commit comments

Comments
 (0)