Skip to content

Commit

Permalink
moving terraform build to Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
shashitnak committed May 23, 2024
1 parent 56cd221 commit 1cd4789
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 0 additions & 10 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -36,7 +27,6 @@ setup_flyctl() {

if [ "$PROVIDER" = "aws" ]; then
cd /aws
setup_terraform
get_tailcall_config
terraform init
terraform apply -auto-approve
Expand Down

0 comments on commit 1cd4789

Please sign in to comment.