Skip to content

Commit

Permalink
feat: add opentofu runner image
Browse files Browse the repository at this point in the history
  • Loading branch information
joryirving committed Jan 15, 2025
1 parent 18241b6 commit 30e187a
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
45 changes: 45 additions & 0 deletions apps/opentofu-runner/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM docker.io/library/alpine:3.21 AS opentofu

ARG VERSION
ARG TARGETARCH
ARG TARGETPLATFORM
ARG TARGETOS

LABEL dev.joryirving.image.target_platform=$TARGETPLATFORM
LABEL dev.joryirving.image.target_architecture=$TARGETARCH
LABEL dev.joryirving.image.target_os=$TARGETOS
LABEL org.opencontainers.image.source="https://github.com/opentofu/opentofu"

RUN \
apk add --no-cache \
bash \
curl \
&& \
case "${TARGETPLATFORM}" in \
'linux/amd64') \
export ARCH='amd64'; \
;; \
'linux/arm64') \
export ARCH='arm64'; \
;; \
esac \
&& curl -fsSL -o /tmp/tofu_${VERSION}_linux_${ARCH}.tar.gz "https://github.com/opentofu/opentofu/releases/download/v${VERSION}/tofu_${VERSION}_linux_${ARCH}.tar.gz" \
&& tar -xzvf /tmp/tofu_${VERSION}_linux_${ARCH}.tar.gz -C /tmp

FROM ghcr.io/flux-iac/tofu-controller:v0.16.0-rc.5 AS runner

ARG VERSION
ARG TARGETARCH
ARG TARGETPLATFORM
ARG TARGETOS

LABEL dev.joryirving.image.target_platform=$TARGETPLATFORM
LABEL dev.joryirving.image.target_architecture=$TARGETARCH
LABEL dev.joryirving.image.target_os=$TARGETOS
LABEL org.opencontainers.image.source="https://github.com/opentofu/opentofu"

USER root

COPY --from=opentofu --chown=65532:65532 /tmp/tofu /usr/local/bin/tofu

USER 65532:65532
5 changes: 5 additions & 0 deletions apps/opentofu-runner/ci/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/goss-org/goss/master/docs/schema.yaml
file:
/usr/local/bin/tofu:
exists: true
5 changes: 5 additions & 0 deletions apps/opentofu-runner/ci/latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
version=$(curl -sX GET "https://api.github.com/repos/opentofu/opentofu/releases/latest" | jq --raw-output '.tag_name')
version="${version#*v}"
version="${version#*release-}"
printf "%s" "${version}"
10 changes: 10 additions & 0 deletions apps/opentofu-runner/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
app: opentofu-runner
semver: true
channels:
- name: stable
platforms: ["linux/amd64", "linux/arm64"]
stable: true
tests:
enabled: false
type: cli

0 comments on commit 30e187a

Please sign in to comment.