Skip to content
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 .github/workflows/test-docker-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Test Docker Build

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

permissions:
contents: read

on:
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

strategy:
matrix:
platform: [linux/amd64]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# For testing, we'll only build and not push
- name: Build Only
uses: docker/build-push-action@v6
with:
push: false
file: docker/Dockerfile
platforms: ${{ matrix.platform }}
tags: ctrlplane/cli:test
context: .
16 changes: 5 additions & 11 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
FROM alpine:3.19 AS builder
FROM golang:1.24-alpine AS builder

ARG CLI_VERSION
WORKDIR /app

RUN apk add --no-cache curl tar && \
ARCH=$(case $(uname -m) in \
"x86_64") echo "x86_64" ;; \
"aarch64") echo "arm64" ;; \
*) echo "x86_64" ;; \
esac) && \
curl -L --fail "https://github.com/ctrlplanedev/cli/releases/download/${CLI_VERSION}/ctrlc_Linux_${ARCH}.tar.gz" -o ctrlc.tar.gz && \
tar xzf ctrlc.tar.gz && \
mv ctrlc /usr/local/bin/ && \
COPY . .

RUN go build -o /usr/local/bin/ctrlc ./cmd/ctrlc && \
chmod +x /usr/local/bin/ctrlc

FROM alpine:3.19 AS final
Expand Down