Skip to content

Commit c1d164a

Browse files
committed
Make the artifacts archive use relative paths to $HOME
1 parent 9c833d7 commit c1d164a

File tree

4 files changed

+29
-11
lines changed

4 files changed

+29
-11
lines changed
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
#!/bin/bash
22

3-
tar -C / -xf -
3+
cd $HOME
4+
5+
exec tar -xzf -
+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
#!/bin/bash
22

3-
tar -cf - /opt/ruby/bundle
3+
cd $HOME
4+
5+
# List the files and directories you would like to archive.
6+
#
7+
exec tar -czf - {bundle,gems}

centos-ruby-builder/bin/start

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ source ${HOME}/etc/helpers
1111
# If the /tmp/src is empty, then print usage and exit.
1212
(dir_is_empty /tmp/src) && print_usage_and_exit
1313

14-
# Detect presence of $stdin and restore the artifacts
14+
# Detect the presence of $stdin and restore the artifacts
15+
# To restore the artifacts, you have to run the builder as:
16+
#
17+
# docker run -v $(pwd):/tmp/src openshift/centos-ruby-builder < artifacts.tgz
1518
#
1619
if [ -p /dev/stdin ]; then
17-
echo "---> Restoring artifacts from STDIN"
18-
cat | /opt/ruby/bin/restore-artifacts
20+
echo "---> Restoring artifacts"
21+
cat | ${HOME}/bin/restore-artifacts
1922
fi
2023

2124
# Build the ruby application first
@@ -24,5 +27,6 @@ ${HOME}/bin/prepare
2427

2528
# Replace this script with the application runner at the end of the build.
2629
#
27-
echo "---> Build successful. Commit this image with: docker commit ${HOSTNAME} ruby-app"
30+
echo "---> Build successful. Commit this image with: 'docker commit ${HOSTNAME} ruby-app'"
31+
2832
cp -f ${HOME}/bin/run ${HOME}/bin/start && exit

centos-ruby-builder/etc/helpers

+13-5
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@
33

44
function print_usage_and_exit() {
55
echo
6-
echo "This image can build your Ruby source code."
7-
echo "To build from a git repo, run this in your checked out repo:"
6+
echo "This is the Ruby/Rails self-contained builder image."
7+
echo "You can use this to produce application images:"
88
echo
9-
echo " docker run -v \$(pwd):/tmp/src openshift/centos-ruby-builder"
9+
echo " $ docker run -v \$(pwd):/tmp/src openshift/centos-ruby-builder"
1010
echo
11-
echo "Options:"
11+
echo "You can also archive artifacts from the current application image:"
12+
echo
13+
echo " $ docker run --entrypoint='${HOME}/bin/save-artifacts' ruby-app > archive.tgz"
14+
echo
15+
echo "And restore the artifacts on the next build:"
16+
echo
17+
echo " $ docker run -v \$(pwd):/tmp/src openshift/centos-ruby-builder < archive.tgz"
18+
echo
19+
echo "Other options:"
1220
echo
1321
echo " --debug Drop to the shell instead of build."
1422
echo
15-
exit
23+
exit 0
1624
}

0 commit comments

Comments
 (0)