-
-
Notifications
You must be signed in to change notification settings - Fork 127
/
Dockerfile.slim
73 lines (58 loc) · 2.28 KB
/
Dockerfile.slim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
FROM alpine:3.18
LABEL maintainer="Cloud Posse <[email protected]>"
LABEL "com.github.actions.name"="Build Harness"
LABEL "com.github.actions.description"="Run any build-harness make target"
LABEL "com.github.actions.icon"="tool"
LABEL "com.github.actions.color"="blue"
RUN apk --no-cache add \
bash \
ca-certificates \
coreutils \
curl \
unzip \
git \
gettext \
grep \
jq \
libc6-compat \
make
RUN git config --global advice.detachedHead false
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl -fsSL --retry 3 https://apk.cloudposse.com/install.sh | bash
## Install as packages
RUN apk --no-cache add \
gomplate@cloudposse \
terraform-0.12@cloudposse terraform-0.13@cloudposse terraform-0.14@cloudposse \
terraform-0.15@cloudposse terraform-1@cloudposse \
terraform-config-inspect@cloudposse \
terraform-docs@cloudposse \
vert@cloudposse
RUN sed -i /PATH=/d /etc/profile
# Use Terraform 1 by default
ARG DEFAULT_TERRAFORM_VERSION=1
RUN update-alternatives --set terraform /usr/share/terraform/$DEFAULT_TERRAFORM_VERSION/bin/terraform
# Install tflint
RUN curl -sSL https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
COPY <<EOF /root/.tflint.hcl
plugin "aws" {
enabled = true
version = "0.26.0"
source = "github.com/terraform-linters/tflint-ruleset-aws"
}
EOF
RUN tflint --init
# Patch for old Makefiles that expect a directory like x.x from the 0.x days.
# Fortunately, they only look for the current version, so we only need links
# for the current major version.
RUN v=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version' | cut -d. -f1-2) && \
major=${v%%\.*} && n=$(( ${v##*\.} + 1 )) && \
for (( x=0; x <= $n; x++ )); do ln -s /usr/local/terraform/{${major},${major}.${x}}; done
COPY ./ /build-harness/
# Set PACKAGES_PREFER_HOST=true to prevent the build-harness from installing packages
# from the cloudposse/packages repository as part of the Docker image build process.
# Any needed packages should be installed in the Dockerfile above here instead.
ENV PACKAGES_PREFER_HOST=true
WORKDIR /build-harness
RUN make -s bash/lint make/lint
RUN make -s template/deps readme/deps
ENTRYPOINT ["/usr/bin/make"]