Skip to content

Instantly share code, notes, and snippets.

@tiborvass
Last active August 29, 2015 14:16
Show Gist options
  • Save tiborvass/fa22b7cf16348bd4c3bf to your computer and use it in GitHub Desktop.
Save tiborvass/fa22b7cf16348bd4c3bf to your computer and use it in GitHub Desktop.
build env workaround
MacBook-Pro:test tibor$ ls -l
total 16
-rw-r--r-- 1 tibor wheel 40 Feb 28 13:36 Dockerfile
-rwxr-xr-x 1 tibor wheel 166 Feb 28 13:45 build.sh
MacBook-Pro:test tibor$ cat Dockerfile
from busybox
copy . /
cmd ["/build.sh"]
MacBook-Pro:test tibor$ cat build.sh
#!/bin/sh
mkdir /tmp/context
echo "$foo" > /tmp/context/hello
cat <<EOF > /tmp/context/Dockerfile
from busybox
copy . /
run cat /hello
EOF
tar -C /tmp/context -c .
MacBook-Pro:test tibor$ docker build -t test .
Sending build context to Docker daemon 3.072 kB
Sending build context to Docker daemon
Step 0 : FROM busybox
---> 4986bf8c1536
Step 1 : COPY . /
---> 4271df3ce7d5
Removing intermediate container 1d2ea83c2fc0
Step 2 : CMD /build.sh
---> Running in acdce69417c0
---> 6bd736ec350f
Removing intermediate container acdce69417c0
Successfully built 6bd736ec350f
MacBook-Pro:test tibor$ docker run -e foo=world test | docker build -t finalimg -
Sending build context to Docker daemon 3.584 kB
Sending build context to Docker daemon
Step 0 : FROM busybox
---> 4986bf8c1536
Step 1 : COPY . /
---> cc43bf8b06cd
Removing intermediate container 874729d32a06
Step 2 : RUN cat /hello
---> Running in 1ef1f73d10cb
world
---> 26975d2d505b
Removing intermediate container 1ef1f73d10cb
Successfully built 26975d2d505b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment