Skip to content

Commit 43018d8

Browse files
author
Mike Vanbuskirk
authored
add base TF config and Dockerfile (#11)
* add base TF config and Dockerfile * add Dockerfile and goreleaser config
1 parent 4a1e9a3 commit 43018d8

File tree

6 files changed

+96
-6
lines changed

6 files changed

+96
-6
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ jobs:
2121
fetch-depth: 0
2222
- name: Set up QEMU
2323
uses: docker/setup-qemu-action@v2
24-
- name: Docker Login to DockerHub
25-
uses: docker/login-action@v2
26-
with:
27-
username: ${{ secrets.DOCKERHUB_USERNAME }}
28-
password: ${{ secrets.DOCKERHUB_TOKEN }}
2924
- name: Docker Login to GitHub Container Registry
3025
uses: docker/login-action@v2
3126
with:
@@ -44,4 +39,3 @@ jobs:
4439
args: release --rm-dist
4540
env:
4641
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}

.goreleaser.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
builds:
2+
- binary: gcp-auditor
3+
ldflags:
4+
- -X 'github.com/trufflesecurity/gcp-auditor/pkg/version.BuildVersion={{ .Version }}'
5+
env: [CGO_ENABLED=0]
6+
goos:
7+
- linux
8+
goarch:
9+
- amd64
10+
- arm64
11+
dockers:
12+
- image_templates: ["trufflesecurity/{{ .ProjectName }}:{{ .Version }}-amd64"]
13+
dockerfile: Dockerfile.goreleaser
14+
use: buildx
15+
build_flag_templates:
16+
- --platform=linux/amd64
17+
- --label=org.opencontainers.image.title={{ .ProjectName }}
18+
- --label=org.opencontainers.image.description={{ .ProjectName }}
19+
- --label=org.opencontainers.image.url=https://github.com/trufflesecurity/{{ .ProjectName }}
20+
- --label=org.opencontainers.image.source=https://github.com/trufflesecurity/{{ .ProjectName }}
21+
- --label=org.opencontainers.image.version={{ .Version }}
22+
- --label=org.opencontainers.image.revision={{ .FullCommit }}
23+
- --label=org.opencontainers.image.licenses=AGPL-3.0
24+
- image_templates: ["trufflesecurity/{{ .ProjectName }}:{{ .Version }}-arm64v8"]
25+
goarch: arm64
26+
dockerfile: Dockerfile.goreleaser
27+
use: buildx
28+
build_flag_templates:
29+
- --platform=linux/arm64/v8
30+
- --label=org.opencontainers.image.title={{ .ProjectName }}
31+
- --label=org.opencontainers.image.description={{ .ProjectName }}
32+
- --label=org.opencontainers.image.url=https://github.com/trufflesecurity/{{ .ProjectName }}
33+
- --label=org.opencontainers.image.source=https://github.com/trufflesecurity/{{ .ProjectName }}
34+
- --label=org.opencontainers.image.version={{ .Version }}
35+
- --label=org.opencontainers.image.revision={{ .FullCommit }}
36+
- --label=org.opencontainers.image.licenses=AGPL-3.0
37+
- image_templates: ["ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-amd64"]
38+
dockerfile: Dockerfile.goreleaser
39+
use: buildx
40+
build_flag_templates:
41+
- --platform=linux/amd64
42+
- --label=org.opencontainers.image.title={{ .ProjectName }}
43+
- --label=org.opencontainers.image.description={{ .ProjectName }}
44+
- --label=org.opencontainers.image.url=https://github.com/trufflesecurity/{{ .ProjectName }}
45+
- --label=org.opencontainers.image.source=https://github.com/trufflesecurity/{{ .ProjectName }}
46+
- --label=org.opencontainers.image.version={{ .Version }}
47+
- --label=org.opencontainers.image.revision={{ .FullCommit }}
48+
- --label=org.opencontainers.image.licenses=AGPL-3.0
49+
- image_templates: ["ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-arm64v8"]
50+
goarch: arm64
51+
dockerfile: Dockerfile.goreleaser
52+
use: buildx
53+
build_flag_templates:
54+
- --platform=linux/arm64/v8
55+
- --label=org.opencontainers.image.title={{ .ProjectName }}
56+
- --label=org.opencontainers.image.description={{ .ProjectName }}
57+
- --label=org.opencontainers.image.url=https://github.com/trufflesecurity/{{ .ProjectName }}
58+
- --label=org.opencontainers.image.source=https://github.com/trufflesecurity/{{ .ProjectName }}
59+
- --label=org.opencontainers.image.version={{ .Version }}
60+
- --label=org.opencontainers.image.revision={{ .FullCommit }}
61+
- --label=org.opencontainers.image.licenses=AGPL-3.0
62+
docker_manifests:
63+
- name_template: ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}
64+
image_templates:
65+
- ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-amd64
66+
- ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-arm64v8
67+
- name_template: ghcr.io/trufflesecurity/{{ .ProjectName }}:latest
68+
image_templates:
69+
- ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-amd64
70+
- ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-arm64v8

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM --platform=${BUILDPLATFORM} golang:bullseye as builder
2+
3+
WORKDIR /build
4+
COPY . .
5+
ENV CGO_ENABLED=0
6+
ARG TARGETOS TARGETARCH
7+
RUN --mount=type=cache,target=/go/pkg/mod \
8+
--mount=type=cache,target=/root/.cache/go-build \
9+
GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o gcp-auditor .
10+
11+
FROM alpine:3.17
12+
RUN apk add --no-cache git ca-certificates \
13+
&& rm -rf /var/cache/apk/* && \
14+
update-ca-certificates
15+
COPY --from=builder /build/gcp-auditor /usr/bin/gcp-auditor
16+
ENTRYPOINT ["/usr/bin/gcp-auditor"]

terraform/auditor.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module "auditor" {
2+
source = ""
3+
4+
name = var.name
5+
project_id = local.project
6+
logging_sink_filter = var.filter
7+
organization_id = var.organization_id
8+
region = var.region
9+
docker_image = var.image
10+
}

terraform/provider.tf

Whitespace-only changes.

terraform/variables.tf

Whitespace-only changes.

0 commit comments

Comments
 (0)