From 1cd4789d6827e24d8c80d4de858d690104edec4a Mon Sep 17 00:00:00 2001 From: Shashi Kant Date: Thu, 23 May 2024 22:27:10 +0000 Subject: [PATCH] moving terraform build to Dockerfile --- Dockerfile | 13 +++++++++++++ entrypoint.sh | 10 ---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3a25584..f038434 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,4 +7,17 @@ COPY fly/Dockerfile /fly/Dockerfile RUN apk upgrade --no-cache && apk update --no-cache RUN apk add --no-cache curl jq go +RUN curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest \ + | jq --raw-output .zipball_url \ + | xargs wget -O /tmp/terraform.zip +RUN unzip /tmp/terraform.zip -d /tmp +RUN go build + +FROM alpine:latest + +COPY --from=builder /entrypoint.sh /entrypoint.sh +COPY --from=builder /aws/tailcall.tf /aws/tailcall.tf +COPY --from=builder /fly/Dockerfile /fly/Dockerfile +COPY --from=builder /tmp/terraform /usr/local/bin/terraform + ENTRYPOINT /bin/sh /entrypoint.sh \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 76134b5..3cd7065 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -19,15 +19,6 @@ get_tailcall_config() { cp "$TAILCALL_CONFIG" . } -setup_terraform() { - curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest \ - | jq --raw-output .zipball_url \ - | xargs wget -O /tmp/terraform.zip - unzip /tmp/terraform.zip -d /tmp - go build - mv /tmp/terraform /usr/local/bin/terraform -} - setup_flyctl() { curl -L https://fly.io/install.sh | sh export FLYCTL_INSTALL="/root/.fly" @@ -36,7 +27,6 @@ setup_flyctl() { if [ "$PROVIDER" = "aws" ]; then cd /aws - setup_terraform get_tailcall_config terraform init terraform apply -auto-approve