[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Changing Environment in STI Builds



Hi Vincent
That seems to work for environment variables used inside the application but not for building the image itself.

Im trying to see if I can change RACK_ENV from production to test in the sample-app by changing the JSON file, and if I add
"spec": {
            "containers": [
              { 
                "name": "ruby-helloworld",
                "image": "origin-ruby-sample",
                "ports": [
                  { 
                    "containerPort": 8080,
                    "protocol": "TCP"
                  }
                ],
                "env": [
                  { 
                    "name": "RACK_ENV",
                    "value": "test"
                  }, 

it still doesnt effect this and uses the value in .sti/environment in the repository. i.e. if I login to the docker container and see the environment variables it shows RACK_ENV=production as thats whats in https://github.com/openshift/ruby-hello-world/blob/master/.sti/environment 

On Tue, Aug 11, 2015 at 12:22 PM, Vincent Behar <v behar free fr> wrote:
Hi,

You can use the “env” array of environment variables in your container definition : https://docs.openshift.org/latest/rest_api/openshift_v1.html#v1-container

Something like :

- kind: DeploymentConfig
  apiVersion: v1
  spec:
    template:
      spec:
        containers:
        - name: ...
          image: ...
          env:
          - name: PORT
            value: "8080"

Vincent

> On 11 Aug 2015, at 08:40, Raja <rajasaur gmail com> wrote:
>
> Hi
>
> Im new to STI and trying to find out how to setup/change environment in STI Builds. The .sti/environment file seems to be the one thats read in the scripts and used for the environment. Is there another way of dynamically setting up what the environment is (Test/Stage/Prod).
>
> Im trying to workout a usecase where a build needs to be promoted from dev to stage and doing a commit right now to change .sti/environment seems to be the way to do it. Is there any other way ?
>
> Thanks
> Raja
>
> --
> Raja
> rajasaur at gmail.com
> _______________________________________________
> users mailing list
> users lists openshift redhat com
> http://lists.openshift.redhat.com/openshiftmm/listinfo/users




--
Raja
rajasaur at gmail.com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]