gopkg.in/openshift/source-to-image.v1@v1.2.0/pkg/create/templates/scripts.go (about)

     1  package templates
     2  
     3  // AssembleScript is a default assemble script laid down by s2i create
     4  const AssembleScript = `#!/bin/bash -e
     5  #
     6  # S2I assemble script for the '{{.ImageName}}' image.
     7  # The 'assemble' script builds your application source so that it is ready to run.
     8  #
     9  # For more information refer to the documentation:
    10  #	https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md
    11  #
    12  
    13  # If the '{{.ImageName}}' assemble script is executed with the '-h' flag, print the usage.
    14  if [[ "$1" == "-h" ]]; then
    15  	exec /usr/libexec/s2i/usage
    16  fi
    17  
    18  # Restore artifacts from the previous build (if they exist).
    19  #
    20  if [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then
    21    echo "---> Restoring build artifacts..."
    22    mv /tmp/artifacts/. ./
    23  fi
    24  
    25  echo "---> Installing application source..."
    26  cp -Rf /tmp/src/. ./
    27  
    28  echo "---> Building application from source..."
    29  # TODO: Add build steps for your application, eg npm install, bundle install, pip install, etc.
    30  `
    31  
    32  // RunScript is a default run script laid down by s2i create
    33  const RunScript = `#!/bin/bash -e
    34  #
    35  # S2I run script for the '{{.ImageName}}' image.
    36  # The run script executes the server that runs your application.
    37  #
    38  # For more information see the documentation:
    39  #	https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md
    40  #
    41  
    42  exec asdf -p 8080
    43  `
    44  
    45  // UsageScript is a default usage script laid down by s2i create
    46  const UsageScript = `#!/bin/bash -e
    47  cat <<EOF
    48  This is the {{.ImageName}} S2I image:
    49  To use it, install S2I: https://github.com/openshift/source-to-image
    50  
    51  Sample invocation:
    52  
    53  s2i build <source code path/URL> {{.ImageName}} <application image>
    54  
    55  You can then run the resulting image via:
    56  docker run <application image>
    57  EOF
    58  `
    59  
    60  // SaveArtifactsScript is a default save artifacts script laid down by s2i
    61  // create
    62  const SaveArtifactsScript = `#!/bin/sh -e
    63  #
    64  # S2I save-artifacts script for the '{{.ImageName}}' image.
    65  # The save-artifacts script streams a tar archive to standard output.
    66  # The archive contains the files and folders you want to re-use in the next build.
    67  #
    68  # For more information see the documentation:
    69  #	https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md
    70  #
    71  # tar cf - <list of files and folders>
    72  `