36 lines
919 B
Text
36 lines
919 B
Text
|
FROM scratch as base
|
||
|
ENV VERSION=0.50.3
|
||
|
ENV SRC_HASH=e90acdbf4cd1dc936e50b580ade53583baced53a93b3b01cee3e073b233ef8c5
|
||
|
ENV SRC_FILE=v${VERSION}.tar.gz
|
||
|
ENV SRC_SITE=https://github.com/terraform-linters/tflint/archive/refs/tags/${SRC_FILE}
|
||
|
ENV GOPATH=/cache/go
|
||
|
ENV GOCACHE=/cache/
|
||
|
ENV GOWORK=off
|
||
|
ENV GOPROXY=https://proxy.golang.org,direct
|
||
|
ENV GOSUMDB=sum.golang.org
|
||
|
ENV CGO_ENABLED=0
|
||
|
ENV GOHOSTOS=linux
|
||
|
ENV GOHOSTARCH=amd64
|
||
|
ENV GO11MODULE=on
|
||
|
|
||
|
FROM base as fetch
|
||
|
COPY --from=stagex/busybox . /
|
||
|
COPY --from=stagex/go . /
|
||
|
COPY --from=stagex/ca-certificates . /
|
||
|
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
|
||
|
RUN tar -xvf ${SRC_FILE}
|
||
|
WORKDIR tflint-${VERSION}
|
||
|
RUN go get ./...
|
||
|
|
||
|
FROM fetch as build
|
||
|
RUN --network=none go build -o out/tflint -v -trimpath
|
||
|
|
||
|
from build as install
|
||
|
RUN <<-EOF
|
||
|
mkdir -p /rootfs/usr/bin/
|
||
|
cp out/tflint /rootfs/usr/bin/
|
||
|
EOF
|
||
|
|
||
|
FROM stagex/filesystem as package
|
||
|
COPY --from=install /rootfs/./ /
|