Build and tag docker image via Expeditor (#2144)

* Build and tag docker image via Expeditor

In order to provide Docker images of all unstable, current, and stable
builds of InSpec, and to avoid having to manually publish Docker images
each time we release InSpec, Expeditor will now take care of this for us.

Signed-off-by: Adam Leff <adam@leff.co>
This commit is contained in:
Adam Leff 2017-09-14 15:16:29 -04:00 committed by GitHub
parent 25687fedad
commit 79ad513a39
3 changed files with 29 additions and 2 deletions

View file

@ -5,6 +5,10 @@ product_key: inspec
rubygems: rubygems:
- inspec - inspec
docker:
build_args:
- GEM_SOURCE: http://artifactory.chef.co/omnibus-gems-local
# Slack channel in Chef Software slack to send notifications about build failures, etc # Slack channel in Chef Software slack to send notifications about build failures, etc
slack: slack:
notify_channel: inspec-notify notify_channel: inspec-notify
@ -40,8 +44,14 @@ merge_actions:
only_if: built_in:bump_version only_if: built_in:bump_version
artifact_actions: artifact_actions:
promoted_to_unstable:
- built_in:build_docker_image
promoted_to_current:
- built_in:tag_docker_image
promoted_to_stable: promoted_to_stable:
- built_in:publish_rubygems - built_in:publish_rubygems
- built_in:rollover_changelog - built_in:rollover_changelog
- built_in:create_github_release - built_in:create_github_release
- built_in:tag_docker_image
- bash:.expeditor/update_dockerfile.sh
- built_in:notify_chefio_slack_channels - built_in:notify_chefio_slack_channels

13
.expeditor/update_dockerfile.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh
#
# This file updates the default VERSION build argument in the Dockerfile to the
# VERSION passed in to the file via environment variables.
#
# This ensures the Dockerfile in inspec master will list the version of the latest
# stable release for any community member who wishes to build their own container
# from scratch.
#
set -evx
sed -i -r "s/^ARG VERSION=.*/ARG VERSION=${VERSION}/" Dockerfile

View file

@ -1,8 +1,12 @@
FROM ruby:alpine FROM ruby:alpine
MAINTAINER Chef Software, Inc. <docker@chef.io>
ARG VERSION=1.36.1
ARG GEM_SOURCE=https://rubygems.org
RUN mkdir /share RUN mkdir /share
COPY inspec.gem /
RUN apk add --update build-base libxml2-dev libffi-dev && \ RUN apk add --update build-base libxml2-dev libffi-dev && \
gem install /inspec.gem --no-document && \ gem install --no-document --source ${GEM_SOURCE} --version ${VERSION} inspec && \
apk del build-base apk del build-base
ENTRYPOINT ["inspec"] ENTRYPOINT ["inspec"]
CMD ["help"] CMD ["help"]