1

I have a deployment process which requires that I access sensitive variables during the docker build phase.

Hi. I'd like to upload my minified javascript during the docker build phase in circleci. Seems straightforward however, I can't get environmental variables to show up during the build phase. I don't want to put my AWS keys in Git. My first problem is I can't get any environmental variable, even if hardcoded, to show up at all on the build system, my second is that I don't want to hardcode them like below (foo, baz).

machine:
  services:
    - docker
  environment:
    foo: bar
    baz: 123
    AWSKEY: $awskey
    AWSSECRET: $awssecret

Upon reading the docs, it looks like I want to do it more like this:

machine:
  services:
    - docker

dependencies:
  cache_directories:
    - elasticsearch-2.4.0
  override:
    - docker info
    - docker build --rm=false -t myapp/im . :
        environment:
          foo: bar
          baz: 123
          AWSKEY: $awskey
          AWSSECRET: $awssecret

And yes this looks promising!

enter image description here

However in the Dockerfile i can

RUN printenv

and i don't see any of these env vars.

enter image description here

SO, could someone tell me what I'm doing wrong? Is my whole idea wrong? Is trying to use AWS creds during the build phase from the environmental variables panel in circle ci possible? (as shown below)

enter image description here

1 Answer 1

0

In the Dockerfile, you can add ENV AWSKEY @value@ and before building the container just replace @value@ with your environment variable $awskey.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.