Skip to content

Commit

Permalink
feat: set default tf & conftest env vars for apline (runatlantis#3806)
Browse files Browse the repository at this point in the history
* Allow DEFAULT_CONFTEST_VERSION and DEFAULT_TERRAFORM_VERSION in alpine image

* update go image to pass build test

---------

Co-authored-by: Damien Sonney <[email protected]>
  • Loading branch information
2 people authored and ijames-gc committed Feb 13, 2024
1 parent 08edd23 commit 0424532
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
ARG ALPINE_TAG=3.18.4
ARG DEBIAN_TAG=12.1-slim

ARG DEFAULT_TERRAFORM_VERSION=1.5.7
ARG DEFAULT_CONFTEST_VERSION=0.46.0

# Stage 1: build artifact and download deps

FROM golang:1.21.2-alpine AS builder
Expand All @@ -14,6 +17,11 @@ ENV ATLANTIS_COMMIT=${ATLANTIS_COMMIT}
ARG ATLANTIS_DATE=unknown
ENV ATLANTIS_DATE=${ATLANTIS_DATE}

ARG DEFAULT_TERRAFORM_VERSION
ENV DEFAULT_TERRAFORM_VERSION=${DEFAULT_TERRAFORM_VERSION}
ARG DEFAULT_CONFTEST_VERSION
ENV DEFAULT_CONFTEST_VERSION=${DEFAULT_CONFTEST_VERSION}

WORKDIR /app

# This is needed to download transitive dependencies instead of compiling them
Expand Down Expand Up @@ -60,7 +68,8 @@ WORKDIR /tmp/build

# install conftest
# renovate: datasource=github-releases depName=open-policy-agent/conftest
ENV DEFAULT_CONFTEST_VERSION=0.46.0
ARG DEFAULT_CONFTEST_VERSION
ENV DEFAULT_CONFTEST_VERSION=${DEFAULT_CONFTEST_VERSION}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN AVAILABLE_CONFTEST_VERSIONS=${DEFAULT_CONFTEST_VERSION} && \
case ${TARGETPLATFORM} in \
Expand Down Expand Up @@ -121,7 +130,8 @@ RUN case ${TARGETPLATFORM} in \

# install terraform binaries
# renovate: datasource=github-releases depName=hashicorp/terraform versioning=hashicorp
ENV DEFAULT_TERRAFORM_VERSION=1.5.7
ARG DEFAULT_TERRAFORM_VERSION
ENV DEFAULT_TERRAFORM_VERSION=${DEFAULT_TERRAFORM_VERSION}

# In the official Atlantis image, we only have the latest of each Terraform version.
# Each binary is about 80 MB so we limit it to the 4 latest minor releases or fewer
Expand Down

0 comments on commit 0424532

Please sign in to comment.