Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9 from docker/autoexecing
Autoexecing
Jim Van Fleet committed Sep 13, 2016
2 parents 20a0689 + 8e84e96 commit 7052fbf
Showing 7 changed files with 58 additions and 3 deletions.
14 changes: 13 additions & 1 deletion Dockerfile
@@ -25,13 +25,25 @@ RUN ln -sf /usr/share/zoneinfo/UTC /etc/localtime \
RUN yum -y install --setopt=tsflags=nodocs epel-release && \
yum -y install net-tools wget curl tar unzip mlocate logrotate strace telnet man unzip vim wget rsyslog cron && \
yum clean all && \
mkdir -p /opt/tier
mkdir -p \
/opt/autoexec/bin \
/opt/autoexec/onbuild \
/opt/autoexec/firstrun \
/opt/bin \
/opt/etc \
/opt/log \
/opt/tier

# Install Trusted Certificates
RUN update-ca-trust force-enable
ADD ./cert/InCommon.crt /etc/pki/ca-trust/source/anchors/
RUN update-ca-trust extract

ADD container_files/bin/firstrun.sh /opt/autoexec/bin/firstrun.sh
ADD container_files/bin/onbuild.sh /opt/autoexec/bin/onbuild.sh
ADD container_files/bin/stub.sh /opt/autoexec/firstrun/stub.sh
ADD container_files/bin/stub.sh /opt/autoexec/onbuild/stub.sh

# Set default environment variables.
ENV HOME /opt/tier

2 changes: 1 addition & 1 deletion Jenkinsfile
@@ -1,4 +1,4 @@
node {
node('docker') {
stage 'Checkout'

checkout scm
6 changes: 5 additions & 1 deletion README.md
@@ -7,4 +7,8 @@ Internet2 managed CentOS 7 base image

## purpose

This container allows I2/TIER to insulate itself against upstream changes from CentOS managed images that may be unwanted. It can also be used to trigger global changes (e.g. a new InCommon.crt) when appropriate.
This container allows I2/TIER to insulate itself against upstream changes from CentOS managed images that may be unwanted. It can also be used to trigger global changes (e.g. a new InCommon.crt) when appropriate.

## autorun

You are encouraged to include /opt/autorun/bin/onbuild.sh when closing your Dockerfiles, and to include /opt/autorun/bin/firstrun.sh in your CMD entrypoints.
6 changes: 6 additions & 0 deletions container_files/bin/firstrun.sh
@@ -0,0 +1,6 @@
#!/bin/bash

for file in /opt/autoexec/firstrun/*
do
exec "$file" >> /opt/log/autoexec.firstrun.log
done
6 changes: 6 additions & 0 deletions container_files/bin/onbuild.sh
@@ -0,0 +1,6 @@
#!/bin/bash

for file in /opt/autoexec/onbuild/*
do
exec "$file" >> /opt/log/autoexec.build.log
done
3 changes: 3 additions & 0 deletions container_files/bin/stub.sh
@@ -0,0 +1,3 @@
#!/bin/bash

echo 'test'
24 changes: 24 additions & 0 deletions tests/base.bats
@@ -14,3 +14,27 @@ load ../common
[ "$status" -eq 0 ]
[[ ${output} == *"302"* || ${output} == *"200"* ]]
}

@test "Onbuild support script" {
docker run -i $maintainer/$imagename find /opt/autoexec/bin/onbuild.sh
}

@test "Onbuild support home" {
docker run -i $maintainer/$imagename find /opt/autoexec/onbuild
}

@test "Firstrun support bin" {
docker run -i $maintainer/$imagename find /opt/autoexec/bin/firstrun.sh
}

@test "Firstrun support home" {
docker run -i $maintainer/$imagename find /opt/autoexec/firstrun
}

@test "Onbuild terminates correctly" {
docker run -i $maintainer/$imagename /opt/autoexec/bin/onbuild.sh
}

@test "First run terminates correctly" {
docker run -i $maintainer/$imagename /opt/autoexec/bin/firstrun.sh
}

0 comments on commit 7052fbf

Please sign in to comment.