Skip to content

Commit

Permalink
add base TF config and Dockerfile (#11)
Browse files Browse the repository at this point in the history
* add base TF config and Dockerfile

* add Dockerfile and goreleaser config
  • Loading branch information
Mike Vanbuskirk committed Apr 10, 2023
1 parent 4a1e9a3 commit 43018d8
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 6 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ jobs:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Docker Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker Login to GitHub Container Registry
uses: docker/login-action@v2
with:
Expand All @@ -44,4 +39,3 @@ jobs:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
70 changes: 70 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
builds:
- binary: gcp-auditor
ldflags:
- -X 'github.com/trufflesecurity/gcp-auditor/pkg/version.BuildVersion={{ .Version }}'
env: [CGO_ENABLED=0]
goos:
- linux
goarch:
- amd64
- arm64
dockers:
- image_templates: ["trufflesecurity/{{ .ProjectName }}:{{ .Version }}-amd64"]
dockerfile: Dockerfile.goreleaser
use: buildx
build_flag_templates:
- --platform=linux/amd64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/trufflesecurity/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/trufflesecurity/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=AGPL-3.0
- image_templates: ["trufflesecurity/{{ .ProjectName }}:{{ .Version }}-arm64v8"]
goarch: arm64
dockerfile: Dockerfile.goreleaser
use: buildx
build_flag_templates:
- --platform=linux/arm64/v8
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/trufflesecurity/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/trufflesecurity/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=AGPL-3.0
- image_templates: ["ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-amd64"]
dockerfile: Dockerfile.goreleaser
use: buildx
build_flag_templates:
- --platform=linux/amd64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/trufflesecurity/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/trufflesecurity/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=AGPL-3.0
- image_templates: ["ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-arm64v8"]
goarch: arm64
dockerfile: Dockerfile.goreleaser
use: buildx
build_flag_templates:
- --platform=linux/arm64/v8
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/trufflesecurity/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/trufflesecurity/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=AGPL-3.0
docker_manifests:
- name_template: ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}
image_templates:
- ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-amd64
- ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-arm64v8
- name_template: ghcr.io/trufflesecurity/{{ .ProjectName }}:latest
image_templates:
- ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-amd64
- ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-arm64v8
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM --platform=${BUILDPLATFORM} golang:bullseye as builder

WORKDIR /build
COPY . .
ENV CGO_ENABLED=0
ARG TARGETOS TARGETARCH
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o gcp-auditor .

FROM alpine:3.17
RUN apk add --no-cache git ca-certificates \
&& rm -rf /var/cache/apk/* && \
update-ca-certificates
COPY --from=builder /build/gcp-auditor /usr/bin/gcp-auditor
ENTRYPOINT ["/usr/bin/gcp-auditor"]
10 changes: 10 additions & 0 deletions terraform/auditor.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module "auditor" {
source = ""

name = var.name
project_id = local.project
logging_sink_filter = var.filter
organization_id = var.organization_id
region = var.region
docker_image = var.image
}
Empty file added terraform/provider.tf
Empty file.
Empty file added terraform/variables.tf
Empty file.

0 comments on commit 43018d8

Please sign in to comment.