Skip to content

Instantly share code, notes, and snippets.

@tianon
Last active August 29, 2015 14:16
Show Gist options
  • Save tianon/34450ecf1c623725daec to your computer and use it in GitHub Desktop.
Save tianon/34450ecf1c623725daec to your computer and use it in GitHub Desktop.
generated, parameterized Dockerfiles
#!/bin/bash
set -e
cat <<-'EOF'
# WARNING: This file is generated. DO NOT MODIFY DIRECTLY.
FROM ubuntu:12.04
RUN ...
EOF
if [ "$SOME_KNOB" ]; then
cat <<-'EOF'
RUN ...
RUN ...
EOF
else
cat <<-'EOF'
RUN ...
RUN ...
ENV ...
EOF
fi
cat <<-'EOF'
RUN ...
ENV ...
RUN ...
CMD [...]
EOF
# ...
build:
./hack/generate-dockerfile.sh > Dockerfile
docker build -t docker .
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment