1
0
mirror of https://github.com/openshift/source-to-image.git synced 2026-02-05 12:44:54 +01:00

Fixed some leftovers from moving to new label scheme including: docs,

getDestination method and template for Dockerfile.
This commit is contained in:
Maciej Szulik
2015-07-06 14:09:30 +02:00
parent 3343fc9a2a
commit faf9f9a2c4
3 changed files with 23 additions and 7 deletions

View File

@@ -16,8 +16,8 @@ final docker image. These are: source code, sti scripts, and the builder image.
build process sti must place sources and scripts inside that builder image. To do
so sti creates a tar file containing the two and then streams that file into the
builder image. Before executing the `assemble` script, sti untars that file and places
its contents into the destination specified with either the `--destination` flag or the value of
the `io.s2i.destination` label set in the builder image (the default destination is `/tmp`).
its contents into the destination specified with either the `--destination` flag or the value of
the `io.openshift.s2i.destination` label set in the builder image (the default destination is `/tmp`).
If your image does not have either `tar` or `/bin/sh` the sti build will perform an additional
docker build to place the source code and scripts into an appropriate image and then run
the normal sti build.
@@ -61,7 +61,7 @@ can be supplied in any of the following forms to indicate where the scripts are
**NOTE**: In the case where the scripts are already placed inside the image (ie when
using `--scripts-url` flag or the `io.openshift.s2i.scripts-url` with the format
`image:///path/in/image`), then the `--destination` flag or the `io.openshift.s2i.destination`
`image:///path/in/image`), then the `--destination` flag or the `io.openshift.s2i.destination`
label applies only to sources and artifacts.
## assemble

View File

@@ -22,7 +22,7 @@ FROM openshift/base-centos7
# TODO (optional): Copy the builder files into /opt/openshift
# COPY ./<builder_folder>/ /opt/openshift/
# TODO: Copy the S2I scripts to /usr/local/sti, since openshift/base-centos7 image sets io.s2i.scripts-url label that way, or update that label
# TODO: Copy the S2I scripts to /usr/local/sti, since openshift/base-centos7 image sets io.openshift.s2i.scripts-url label that way, or update that label
# COPY ./.sti/bin/ /usr/local/sti
# TODO: Drop the root user and make the content of /opt/openshift owned by user 1001

View File

@@ -15,19 +15,30 @@ import (
)
const (
// Deprecated environment variable name, specifying where to look for the S2I scripts.
// It is now being replaced with ScriptsURLLabel.
ScriptsURLEnvironment = "STI_SCRIPTS_URL"
LocationEnvironment = "STI_LOCATION"
// Deprecated environment variable name, specifying where to place artifacts in
// builder image. It is now being replaced with DestinationLabel.
LocationEnvironment = "STI_LOCATION"
// ScriptsURLLabel is the name of the Docker image LABEL that tells S2I where
// to look for the S2I scripts. This label is also copied into the ouput
// image.
// The previous name of this label was 'io.s2i.scripts-url'. This is now
// deprecated.
ScriptsURLLabel = api.DefaultNamespace + "scripts-url"
ScriptsURLLabel = api.DefaultNamespace + "scripts-url"
// DestinationLabel is the name of the Docker image LABEL that tells S2I where
// to place the artifacts (scripts, sources) in the builder image.
// The previous name of this label was 'io.s2i.destination'. This is now
// deprecated
DestinationLabel = api.DefaultNamespace + "destination"
// DefaultDestination is the destination where the artifacts will be placed
// if DestinationLabel was not specified.
DefaultDestination = "/tmp"
DefaultTag = "latest"
// DefaultTag is the image tag, being applied if none is specified.
DefaultTag = "latest"
)
// Docker is the interface between STI and the Docker client
@@ -289,6 +300,11 @@ func getDestination(image *docker.Image) string {
if val := getLabel(image, DestinationLabel); len(val) != 0 {
return val
}
// For backward compatibility, support the old label schema
if val := getLabel(image, "io.s2i.destination"); len(val) != 0 {
glog.Warningf("The 'io.s2i.destination' label is deprecated. Use %q instead.", DestinationLabel)
return val
}
if val := getVariable(image, LocationEnvironment); len(val) != 0 {
glog.Warningf("BuilderImage uses deprecated environment variable %s, please migrate it to %s label instead!",
LocationEnvironment, DestinationLabel)