Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add opentofu runner image #201

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading