alpine-docker / terragrunt

Auto-trigger docker build for terragrunt when new terraform version released
Apache License 2.0
35 stars 24 forks source link

WIP: Use multi-stage build to reduce image size #1

Closed kalioz closed 3 years ago

kalioz commented 4 years ago

Using a ADD xyz followed by a RUN chmod +x xyz doubles the space the binary takes in the final (non-squashed) image. Using a builder step enables to do such changes and to only keep the final modified binary in the image.

extract from dive :

1.6 MB  |1 TERRAGRUNT=v0.22.3 /bin/sh -c apk add --update --no-cache bash git openssh                               
 30 MB  #(nop) ADD 823a882abb701f3e1a41e282495ea9f11256063efd3a9e1d2a15fd67ae4a673f in /usr/local/bin/terragrunt
 30 MB  |1 TERRAGRUNT=v0.22.3 /bin/sh -c chmod +x /usr/local/bin/terragrunt
   0 B  #(nop) WORKDIR /apps
billyfoss commented 3 years ago

As an alternative to the build image pattern, the following will add the image without the double layer size.

RUN wget https://github.com/gruntwork-io/terragrunt/releases/download/${TERRAGRUNT_VERSION}/terragrunt_linux_amd64 -O /usr/local/bin/terragrunt && \
    chmod +x /usr/local/bin/terragrunt

I like what you are doing with distinguishing between the Terraform and Terragrunt versions.

ozbillwang commented 3 years ago

closed, you can reopen if need.