diff --git a/build/package/goreleaser/Dockerfile.core b/build/package/goreleaser/Dockerfile.core new file mode 100644 index 000000000..6ea243a83 --- /dev/null +++ b/build/package/goreleaser/Dockerfile.core @@ -0,0 +1,10 @@ +FROM alpine AS builder + +RUN apk add --no-cache ca-certificates + +FROM scratch + +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY rig-operator /usr/local/bin/ + +CMD ["rig-operator"] diff --git a/build/package/goreleaser/goreleaser.yml b/build/package/goreleaser/goreleaser.yml index 8639cb5df..3362921dd 100644 --- a/build/package/goreleaser/goreleaser.yml +++ b/build/package/goreleaser/goreleaser.yml @@ -65,6 +65,22 @@ builds: - -X github.com/rigdev/rig/internal/build.version={{ .Version }} - -X github.com/rigdev/rig/internal/build.commit={{ .Commit }} - -X github.com/rigdev/rig/internal/build.date={{ .Date }} + - id: rig-operator + binary: rig-operator + main: ./cmd/rig-operator + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + ldflags: + - -s -w + - -X github.com/rigdev/rig/internal/build.version={{ .Version }} + - -X github.com/rigdev/rig/internal/build.commit={{ .Commit }} + - -X github.com/rigdev/rig/internal/build.date={{ .Date }} archives: - id: rig-server @@ -90,6 +106,15 @@ archives: format_overrides: - goos: windows format: zip + - id: rig-operator + format: tar.gz + builds: + - rig-operator + name_template: >- + rig-operator_ + {{- .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else }}{{ .Arch }}{{ end }} checksum: name_template: 'checksums.txt' @@ -110,6 +135,21 @@ dockers: build_flag_templates: - "--platform=linux/arm64" +- image_templates: + - "ghcr.io/rigdev/rig-core:{{ .Version }}-amd64" + goarch: amd64 + dockerfile: build/package/goreleaser/Dockerfile.core + use: buildx + build_flag_templates: + - "--platform=linux/amd64" +- image_templates: + - "ghcr.io/rigdev/rig-core:{{ .Version }}-arm64" + goarch: arm64 + dockerfile: build/package/goreleaser/Dockerfile.core + use: buildx + build_flag_templates: + - "--platform=linux/arm64" + docker_manifests: - name_template: "ghcr.io/rigdev/rig:latest" image_templates: @@ -128,6 +168,23 @@ docker_manifests: - "ghcr.io/rigdev/rig:{{ .Version }}-amd64" - "ghcr.io/rigdev/rig:{{ .Version }}-arm64" + - name_template: "ghcr.io/rigdev/rig-core:latest" + image_templates: + - "ghcr.io/rigdev/rig-core:{{ .Version }}-amd64" + - "ghcr.io/rigdev/rig-core:{{ .Version }}-arm64" + - name_template: "ghcr.io/rigdev/rig-core:{{ .Major }}" + image_templates: + - "ghcr.io/rigdev/rig-core:{{ .Version }}-amd64" + - "ghcr.io/rigdev/rig-core:{{ .Version }}-arm64" + - name_template: "ghcr.io/rigdev/rig-core:{{ .Major }}.{{ .Minor }}" + image_templates: + - "ghcr.io/rigdev/rig-core:{{ .Version }}-amd64" + - "ghcr.io/rigdev/rig-core:{{ .Version }}-arm64" + - name_template: "ghcr.io/rigdev/rig-core:{{ .Version }}" + image_templates: + - "ghcr.io/rigdev/rig-core:{{ .Version }}-amd64" + - "ghcr.io/rigdev/rig-core:{{ .Version }}-arm64" + changelog: sort: asc filters: diff --git a/cmd/rig-operator/main.go b/cmd/rig-operator/main.go index d4d2e8601..2803159dd 100644 --- a/cmd/rig-operator/main.go +++ b/cmd/rig-operator/main.go @@ -3,6 +3,7 @@ package main import ( "context" + "github.com/rigdev/rig/internal/build" "github.com/rigdev/rig/pkg/config" "github.com/rigdev/rig/pkg/manager" "github.com/spf13/cobra" @@ -24,6 +25,8 @@ func main() { flags := c.PersistentFlags() flags.StringP(flagConfigFile, "c", "/etc/rig-operator/config.yaml", "path to rig-operator config file") + c.AddCommand(build.VersionCommand()) + ctx := context.Background() c.ExecuteContext(ctx) }