hashicorp / docker-hub-images

Automatic builds of container images for Docker Hub
Mozilla Public License 2.0
127 stars 110 forks source link

A bloated image #33

Closed xenoterracide closed 7 years ago

xenoterracide commented 7 years ago

I feel like the obvious answer should be given to this is no... but I have to ask to solve my problem

Wercker my CI/CD solution, apparently executes some of their code within the container. I can't really explain the problem because I believe that their is a red herring regarding the error message that I get. I'm currently attempting to work with their support in order to resolve the issue, but so far that's not going well.

Their code seems to explicitly have problem executing in Alpine, after some trials with installing bash into an extension, and changing the entrypoint, etc, I've only been able to deduce that they are trying something alpine can't do, and it has nothing to do with mkdir -p /pipeline (the "failing command")

So this request is to create a fat image based on ubuntu, debian, centos, etc, any of those should work. I wrote this based on your image, but I imagine maintaining will be hard as I'll have to pay attention to updates.

A side improvement that would make maintaing my own image easier is to have a LATEST, or CURRENT, files so instead of needing to fetch a VERSION, I could simply refer to LATEST.

FROM ubuntu:latest
RUN apt-get update && apt-get --assume-yes install wget unzip && apt-get clean
ENV TERRAFORM_VERSION=0.8.8
ENV TERRAFORM_SHA256SUM=403d65b8a728b8dffcdd829262b57949bce9748b91f2e82dfd6d61692236b376
RUN  wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip  && \
    echo "${TERRAFORM_SHA256SUM}  terraform_${TERRAFORM_VERSION}_linux_amd64.zip" > terraform_${TERRAFORM_VERSION}_SHA256SUMS && \
    sha256sum -c terraform_${TERRAFORM_VERSION}_SHA256SUMS && \
    unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /bin && \
    rm -f terraform_${TERRAFORM_VERSION}_linux_amd64.zip
xenoterracide commented 7 years ago

ultimately the insanity has been figured out... the entrypoint is making it hard to use the image in this ci environment, but it can be used like this.

box:
  id: hashicorp/terraform:light
  cmd: /bin/sh
  entrypoint: /bin/sh -c
plan:
  steps:
  - script:
      name: terraform remote config
      code: |
        /bin/terraform remote config -backend=s3 \
          -backend-config="bucket=com_xenoterracide_terraform_prod" \
          -backend-config="key=iam.tfstate" \
          -backend-config="region=us-east-1"
  - script:
      name: terraform plan
      code: /bin/terraform plan

apply:
  steps:
  - script:
      name: terraform apply
      code: /bin/terraform apply