-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom Docker image offering (#130)
Co-authored-by: Patrick D'appollonio <[email protected]>
- Loading branch information
1 parent
cffc74d
commit b5bf93c
Showing
3 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ on: | |
tags: | ||
- "*" | ||
|
||
permissions: | ||
packages: write | ||
|
||
jobs: | ||
goreleaser: | ||
name: Release Application | ||
|
@@ -23,6 +26,14 @@ jobs: | |
version: latest | ||
- name: Test application | ||
run: go test -v ./... | ||
- name: Set up QEMU | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: "ghcr.io" | ||
username: ${{ github.repository_owner}} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-actions@v3 | ||
- name: Release application to Github | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
|
@@ -33,3 +44,4 @@ jobs: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Update new version in krew-index | ||
uses: rajatjindal/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
ARG KUBECTL_VERSION=1.31.1 | ||
ARG YQ_VERSION=v4.44.3 | ||
|
||
# Stage 1: Download binaries | ||
FROM debian:12-slim as download_binary | ||
|
||
ARG KUBECTL_VERSION | ||
ARG YQ_VERSION | ||
|
||
# Install curl and certificates, and clean up in one layer to reduce image size | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
curl \ | ||
ca-certificates \ | ||
&& rm -rf /var/lib/apt/lists* | ||
|
||
# Download kubectl binary | ||
RUN curl -sSL -o /kubectl "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \ | ||
&& chmod +x /kubectl | ||
|
||
# Download yq binary | ||
RUN curl -sSL -o /yq "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" \ | ||
&& chmod +x /yq | ||
|
||
# Stage 2 | ||
FROM debian:12-slim | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
sudo \ | ||
&& useradd -m -s /bin/bash slice \ | ||
&& echo 'slice ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/slice \ | ||
&& chmod 0440 /etc/sudoers.d/slice \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy binaries from the download_binary stage | ||
COPY --from=download_binary /kubectl /usr/local/bin/kubectl | ||
COPY --from=download_binary /yq /usr/local/bin/yq | ||
COPY --from=download_binary /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
|
||
# Copy kubectl-slice from local filesystem | ||
COPY kubectl-slice /usr/local/bin/kubectl-slice | ||
|
||
USER slice | ||
WORKDIR /home/slice |