From 999c57401f5d3ef7a4131211a34494b25b485c25 Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Sun, 10 Sep 2023 23:56:03 +0200
Subject: [PATCH] feat(opentf): inital release

---
 images/.utils/gitlab-ci.yaml |  1 +
 images/opentf/.release       |  1 +
 images/opentf/Earthfile      | 29 +++++++++++++++++++++++++++++
 3 files changed, 31 insertions(+)
 create mode 100644 images/opentf/.release
 create mode 100644 images/opentf/Earthfile

diff --git a/images/.utils/gitlab-ci.yaml b/images/.utils/gitlab-ci.yaml
index 7d7c2e6e9..4e8e1bf52 100644
--- a/images/.utils/gitlab-ci.yaml
+++ b/images/.utils/gitlab-ci.yaml
@@ -13,6 +13,7 @@ container-build:
           - synadm
           - query-exposer
           - findmydevice-server
+          - opentf
   script:
     - cd images/${IMAGE}
     - |
diff --git a/images/opentf/.release b/images/opentf/.release
new file mode 100644
index 000000000..85f180f38
--- /dev/null
+++ b/images/opentf/.release
@@ -0,0 +1 @@
+release=0.1.0
diff --git a/images/opentf/Earthfile b/images/opentf/Earthfile
new file mode 100644
index 000000000..fd580da52
--- /dev/null
+++ b/images/opentf/Earthfile
@@ -0,0 +1,29 @@
+VERSION 0.7
+
+build:
+    FROM ../mirror+golang
+    WORKDIR /go-workdir
+    GIT CLONE https://github.com/opentffoundation/opentf.git ./
+    ENV CGO_ENABLED=0
+    RUN go build -mod=readonly -trimpath
+    SAVE ARTIFACT ./opentf ./opentf
+
+container-internal:
+    FROM ../mirror+distroless-static
+    COPY +build/opentf /usr/local/bin/opentf
+    ENTRYPOINT ["/usr/local/bin/opentf"]
+
+container:
+    FROM ../mirror+golang
+    ARG registry=quay.io/shivering-isles/opentf
+    COPY .release ./
+    ARG tag=$(awk -F'=' '$1 == "release" {print $2}' .release)
+    ARG latest=false
+    IF [ $latest = "true" ]
+        FROM +container-internal
+        SAVE IMAGE --push ${registry}:latest
+    ELSE
+        FROM +container-internal
+        LABEL "quay.expires-after"="12w"
+    END
+    SAVE IMAGE --push ${registry}:${tag}
-- 
GitLab