bash m5.bash Dockerfile.m5 |docker build -
Last active
August 29, 2015 14:12
-
-
Save ahoy-jon/e8c534883a5a8c87c046 to your computer and use it in GitHub Desktop.
m5 : an attempt to fix some Dockerfile missing features without m4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM dockerfile/ubuntu | |
INCLUDE "javaruby.m5" | |
#ADD MYAPP ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM dockerfile/ubuntu | |
#This file use existing Dockerfiles to build a working Java 8 + Ruby 2.2 env !!!! | |
INCLUDE "https://raw.githubusercontent.com/docker-library/buildpack-deps/master/wheezy/Dockerfile" | |
INCLUDE "https://github.com/docker-library/ruby/raw/master/2.2/wheezy/Dockerfile" | |
INCLUDE "https://raw.githubusercontent.com/dockerfile/java/master/oracle-java8/Dockerfile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[[ $2 = "--sub" ]] && SUB=true || SUB=false | |
if [[ $1 == http* ]] ; then | |
if hash wget 2>/dev/null ; then | |
wget –quiet -O - -o /dev/null $1 | |
else | |
curl –silent -kL $1 2>/dev/null | |
fi | |
else | |
cat $1 | |
fi | sed '$a\' | while read line | |
do | |
if [[ $SUB = true && $line =~ ^FROM\ .+ ]] | |
then | |
#if the line is from a sub file and starts with a from | |
#quote the line | |
echo "#$line" | |
else | |
# if not (a sub file and line is a FROM) | |
if [[ $line =~ ^INCLUDE\ \"(.+)\" ]] | |
then | |
#if the line is a include instruction | |
#quote the line | |
echo "" | |
echo "#$line #IN $1" | |
#and recursively call the script with the sub flag | |
bash $0 ${BASH_REMATCH[1]} --sub | |
else | |
#else just print the line | |
echo "$line" | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment