mirror of
https://github.com/openshift/source-to-image.git
synced 2026-02-05 12:44:54 +01:00
Allow incremental --as-dockerfile builds. Trello card: https://trello.com/c/P6TZg0wO/1582-5-builds-s2i-incremental-build-as-dockerfile
37 lines
1.2 KiB
Bash
Executable File
37 lines
1.2 KiB
Bash
Executable File
#!/bin/bash -e
|
|
#
|
|
# S2I assemble script for the 'nginx-centos7' image.
|
|
# The 'assemble' script builds your application source so that it is ready to run.
|
|
#
|
|
# For more information refer to the documentation:
|
|
# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md
|
|
#
|
|
|
|
if [[ "$1" == "-h" ]]; then
|
|
# If the 'nginx-centos7' assemble script is executed with '-h' flag,
|
|
# print the usage.
|
|
exec /usr/libexec/s2i/usage
|
|
fi
|
|
|
|
# Restore artifacts from the previous build (if they exist).
|
|
# We set them here just for show, but you will need to set this up with your logic
|
|
# according to the application directory that you chose.
|
|
|
|
if [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then
|
|
echo "---> Restoring build artifacts..."
|
|
mv /tmp/artifacts/* /etc/nginx
|
|
fi
|
|
|
|
# Override the default nginx index.html file.
|
|
# This is what we consider in this example 'installing the application'
|
|
# here you can go ahead an replace this with the actual building of python modules,
|
|
# bundle install, and anything else you need.
|
|
|
|
echo "---> Building and installing application from source..."
|
|
if [ -f /tmp/src/nginx.conf ]; then
|
|
mv /tmp/src/nginx.conf /etc/nginx/nginx.conf
|
|
fi
|
|
if [ "$(ls -A /tmp/src)" ]; then
|
|
mv /tmp/src/* /usr/share/nginx/html/
|
|
fi
|