2024-02-09 07:30:28 +00:00
|
|
|
FROM scratch as base
|
2023-12-23 01:58:45 +00:00
|
|
|
ENV VERSION=1.6.0-beta4
|
|
|
|
ENV SRC_HASH=b14f151839d90d06f95ba4257be159857606daf522d99e9285ddb248f814393f
|
2024-02-09 07:30:28 +00:00
|
|
|
ENV SRC_FILE=v${VERSION}.tar.gz
|
2024-02-14 22:56:29 +00:00
|
|
|
ENV SRC_SITE=https://github.com/opentofu/opentofu/archive/refs/tags/${SRC_FILE}
|
2023-12-23 01:58:45 +00:00
|
|
|
|
|
|
|
FROM base as fetch
|
2024-02-09 07:30:28 +00:00
|
|
|
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
|
2023-12-23 01:58:45 +00:00
|
|
|
|
|
|
|
FROM fetch as build
|
2024-02-15 15:22:38 +00:00
|
|
|
COPY --from=stagex/busybox . /
|
|
|
|
COPY --from=stagex/go . /
|
|
|
|
COPY --from=stagex/ca-certificates . /
|
2023-12-23 01:58:45 +00:00
|
|
|
RUN tar -xvf v${VERSION}.tar.gz
|
|
|
|
WORKDIR opentofu-${VERSION}
|
|
|
|
ENV PWD=/home/user/opentofu-${VERSION}
|
|
|
|
ENV GOPATH=${PWD}/cache/go
|
|
|
|
ENV GOCACHE=${PWD}/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
|
2024-02-05 10:36:12 +00:00
|
|
|
ENV GOFLAGS=-trimpath
|
2023-12-23 01:58:45 +00:00
|
|
|
RUN mkdir -p ${GOPATH}
|
|
|
|
RUN go build -o bin/tofu ./cmd/tofu
|
|
|
|
|
|
|
|
from build as install
|
2024-02-09 07:30:28 +00:00
|
|
|
RUN <<-EOF
|
|
|
|
mkdir -p /rootfs/usr/bin/
|
|
|
|
cp bin/tofu /rootfs/usr/bin/
|
|
|
|
EOF
|
2024-02-09 18:19:36 +00:00
|
|
|
RUN find /rootfs -exec touch -hcd "@0" "{}" +
|
2023-12-23 01:58:45 +00:00
|
|
|
|
2024-02-28 15:39:48 +00:00
|
|
|
FROM stagex/filesystem as package
|
|
|
|
COPY --from=install /rootfs/./ /
|