diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 089b86e..58cec8d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -26,26 +26,28 @@ jobs: uses: actions/checkout@v4 - name: Log in to the Container registry - uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 + uses: docker/setup-buildx-action@v3 - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.1.1 + uses: docker/metadata-action@v5 with: images: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" - name: Build and push Docker image - uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 + uses: docker/build-push-action@v5 with: context: . push: true + platforms: | + linux/amd64 + linux/arm64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index cd98284..16fd938 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -18,7 +18,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v4 with: - version: v1.55.2 + version: v1.58.2 test: name: Unit Test @@ -41,7 +41,7 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: azure/setup-helm@b7246b12e77f7134dc2d460a3d5bad15bbe29390 # v4.1.0 + - uses: azure/setup-helm@v4 - name: Helm Lint run: helm lint charts/radix-oauth-guard diff --git a/Dockerfile b/Dockerfile index 187dd37..74c1bb8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,7 @@ -FROM golang:1.22-alpine3.19 as builder - -RUN apk update && \ - apk add bash jq alpine-sdk sed gawk git ca-certificates curl && \ - apk add --no-cache gcc musl-dev - +FROM --platform=$BUILDPLATFORM golang:1.22-alpine3.20 as builder +# Define target arch variables so we can use them while crosscompiling, will be set automatically +ARG TARGETOS +ARG TARGETARCH WORKDIR /go/src/ # get dependencies @@ -14,15 +12,12 @@ RUN go mod download COPY . . # Build project -RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -a -installsuffix cgo -o /radix-oauth-guard +RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -ldflags "-s -w" -a -installsuffix cgo -o /radix-oauth-guard -RUN addgroup -S -g 1000 guard -RUN adduser -S -u 1000 -G guard guard -FROM scratch +FROM --platform=$TARGETPLATFORM scratch COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -COPY --from=builder /etc/passwd /etc/passwd COPY --from=builder /radix-oauth-guard /radix-oauth-guard EXPOSE 8000 diff --git a/Makefile b/Makefile index 073d00a..4009ed0 100644 --- a/Makefile +++ b/Makefile @@ -25,5 +25,5 @@ HAS_GOLANGCI_LINT := $(shell command -v golangci-lint;) bootstrap: ifndef HAS_GOLANGCI_LINT - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2 + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.58.2 endif diff --git a/charts/radix-oauth-guard/Chart.yaml b/charts/radix-oauth-guard/Chart.yaml index 68297c2..647f3ff 100644 --- a/charts/radix-oauth-guard/Chart.yaml +++ b/charts/radix-oauth-guard/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: radix-oauth-guard icon: https://radix.equinor.com/images/logos/logo.svg description: Forward Auth to validate, authenticate and authorize JWT tokens -appVersion: 0.4.0 -version: 0.4.0 +appVersion: 0.5.0 +version: 0.5.0 kubeVersion: ">=1.24.0" keywords: - radix