Skip to content

Commit c0b27eb

Browse files
dylanratcliffeDavidS-ovm
authored andcommitted
Create a docker container for the CLI (#2916)
We have a customer doing a POC that is creating their own image for the CLI because the pipeline software they use requires that each step be in a docker container. We should provide the container for them so they don't have to keep it up to date **DO NOT MERGE:** I want this to be reviewed but we'll need to cut a release after this is merged and therefore will need to be tracked --------- Co-authored-by: David Schmitt <[email protected]> GitOrigin-RevId: d7b237be7a1dfa54f7264c6fd18602b326eda1a5
1 parent 5772ab6 commit c0b27eb

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build and Release Docker Container
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build-and-push:
10+
name: Build and Push CLI Container
11+
runs-on: depot-ubuntu-22.04
12+
13+
permissions:
14+
contents: write
15+
packages: write
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v5
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Extract version from tag
24+
id: extract_version
25+
run: |
26+
VERSION=${GITHUB_REF#refs/tags/v}
27+
echo "version=$VERSION" >> $GITHUB_OUTPUT
28+
echo "Version: $VERSION"
29+
30+
- name: Login to GitHub Container Registry
31+
uses: docker/login-action@v3
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- uses: depot/use-action@main
38+
with:
39+
project: xnsnw3m20t
40+
41+
- name: Build and push container
42+
uses: depot/build-push-action@v1
43+
id: build
44+
with:
45+
project: xnsnw3m20t
46+
context: .
47+
file: ./Dockerfile
48+
sbom: true
49+
platforms: linux/amd64,linux/arm64
50+
push: true
51+
tags: |
52+
ghcr.io/overmindtech/cli:latest
53+
ghcr.io/overmindtech/cli:${{ steps.extract_version.outputs.version }}

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM ghcr.io/opentofu/opentofu:minimal AS tofu
2+
3+
FROM alpine:3.22.2
4+
5+
# Copy the tofu binary from the minimal image
6+
COPY --from=tofu /usr/local/bin/tofu /usr/local/bin/tofu
7+
8+
# Add the Overmind public key directly
9+
ADD https://dl.cloudsmith.io/public/overmind/tools/rsa.7B6E65C2058FDB78.key \
10+
/etc/apk/keys/[email protected]
11+
12+
# Add repository config
13+
ADD https://dl.cloudsmith.io/public/overmind/tools/config.alpine.txt?distro=alpine&codename=v3.8 \
14+
/tmp/config.alpine.txt
15+
RUN cat /tmp/config.alpine.txt >> /etc/apk/repositories \
16+
&& rm /tmp/config.alpine.txt
17+
18+
RUN apk update
19+
RUN apk add --no-cache overmind-cli

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,17 @@ Then install the CLI:
173173
apk add overmind-cli
174174
```
175175

176+
### Container / Docker
177+
178+
You can use the CLI via Docker which includes both OpenTofu and the CLI:
179+
180+
```shell
181+
docker pull ghcr.io/overmindtech/cli:latest
182+
docker run --rm ghcr.io/overmindtech/cli:latest overmind terraform plan
183+
```
184+
185+
This is useful for CI/CD environments where you need a reproducible Terraform execution environment.
186+
176187
### Arch
177188

178189
Packages for Arch are available on the [releases page](https://github.com/overmindtech/cli/releases/latest) for manual download and installation.

0 commit comments

Comments
 (0)