Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.
Open
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
24 changes: 19 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,23 @@ jobs:
run: |
curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_linux_amd64.tar.gz -o /tmp/kb.tgz
tar zxf /tmp/kb.tgz -C /tmp/
- name: Run GoReleaser
env:
KUBEBUILDER_ASSETS: /tmp/kubebuilder_2.3.1_linux_amd64/bin/
uses: goreleaser/goreleaser-action@v1.3.1
# - name: Run GoReleaser
# env:
# KUBEBUILDER_ASSETS: /tmp/kubebuilder_2.3.1_linux_amd64/bin/
# uses: goreleaser/goreleaser-action@v1.3.1
# with:
# args: release --snapshot --skip-publish --rm-dist --skip-sign
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Packages Docker Registry
uses: docker/login-action@v1
with:
args: release --snapshot --skip-publish --rm-dist --skip-sign
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build
run: make docker-build
env:
IMAGE_NAMESPACE: ghcr.io/nslhb
11 changes: 8 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ before:
- go test ./...

builds:
-
-
env:
- CGO_ENABLED=0
ldflags:
- '-s -w -X "github.com/hashicorp/terraform-k8s/version.Version={{ .Version }}" -X "github.com/hashicorp/terraform-k8s/version.Prerelease="'
- '-s -w -X "github.com/nslhb/terraform-k8s/version.Version={{ .Version }}" -X "github.com/nslhb/terraform-k8s/version.Prerelease="'
goos:
- linux
- windows
- darwin
targets:
- linux_amd64
- amd64
- arm64

archives:
-
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the terraform-k8s binary
FROM golang:1.15-alpine as builder
FROM golang:1.15 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -13,7 +13,7 @@ RUN go mod download
COPY . .

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o terraform-k8s main.go
RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -a -o terraform-k8s main.go

FROM alpine:3.12.1
WORKDIR /
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

# Image URL to use all building/pushing image targets
IMG ?= terraform-k8s:latest
VERSION?=$(shell git rev-parse --short HEAD)
IMG ?= ghcr.io/nslhb/terraform-k8s
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"

Expand Down Expand Up @@ -71,8 +72,8 @@ generate:
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

# Build the docker image
docker-build: test
docker build . -t ${IMG}
docker-build:
docker buildx build --platform="linux/amd64,linux/arm64" --push -t $(IMG):$(VERSION) .

# Push the docker image
docker-push:
Expand Down
Loading