This file contains hidden or 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 golang:latest | |
| # If RELEASE is not passed as a build arg, go with master | |
| ARG RELEASE=master | |
| WORKDIR /go | |
| ENV GOBIN $GOPATH/bin | |
| RUN echo "Using Hacher ${RELEASE}" \ | |
| && wget -q https://github.com/Dockbit/hacher/archive/${RELEASE}.tar.gz -O hacher-${RELEASE}.tar.gz \ | |
| && tar xf hacher-${RELEASE}.tar.gz \ | |
| && cd hacher-* \ |
This file contains hidden or 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
| docker build -t hacher:latest --build-arg RELEASE=v0.1.0 . |
This file contains hidden or 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 golang:latest as builder | |
| # If RELEASE is not passed as a build arg, go with master | |
| ARG RELEASE=master | |
| WORKDIR /go | |
| ENV GOBIN $GOPATH/bin | |
| RUN echo "Using Hacher ${RELEASE}" \ | |
| && wget -q https://github.com/Dockbit/hacher/archive/${RELEASE}.tar.gz -O hacher-${RELEASE}.tar.gz \ | |
| && tar xf hacher-${RELEASE}.tar.gz \ | |
| && cd hacher-* \ |
This file contains hidden or 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
| $ ls | |
| 2.1 2.3 Dockerfile.template render.sh | |
| $ cd 2.1 && docker build -t my_app:2.1 . | |
| Sending build context to Docker daemon 2.048 kB | |
| Step 1 : FROM ruby:2.1 | |
| ---> 2903b59d264e | |
| Step 2 : CMD ruby --version | |
| ---> Running in cea80b05db0f | |
| ---> 08c4ae2b2188 | |
| Removing intermediate container cea80b05db0f |
This file contains hidden or 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 | |
| render() { | |
| sedStr=" | |
| s!%%RUBY_VERSION%%!$version!g; | |
| " | |
| sed -r "$sedStr" $1 | |
| } |
This file contains hidden or 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 ruby:%%RUBY_VERSION%% | |
| CMD ruby --version |
This file contains hidden or 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
| $ docker build -t my_app . | |
| $ docker run -e feature_enabled=true my_app | |
| Feature activated |
This file contains hidden or 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 busybox | |
| ENV feature_enabled false | |
| CMD sh -c 'if [ "$feature_enabled" = true ]; then echo "Feature activated"; else echo "Feature not activated"; fi' |
This file contains hidden or 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
| Sending build context to Docker daemon 1.2 MB | |
| Step 1 : FROM busybox | |
| ---> 1efc1d465fd6 | |
| Step 2 : ARG app_version | |
| ---> Running in 94d310838e79 | |
| ---> 576425d2c33e | |
| Removing intermediate container 94d310838e79 | |
| Step 3 : RUN echo “Building $app_version” | |
| ---> Running in 7683d34558d1 | |
| “Building 1.0” |
This file contains hidden or 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 busybox | |
| ARG app_version | |
| RUN echo “Building $app_version” |