Skip to content

Commit

Permalink
Add multiarch output (#9)
Browse files Browse the repository at this point in the history
* Add multiarch output

* define args

* update alpine to 3.20, linting to 1.58.2
  • Loading branch information
Richard87 authored Jun 19, 2024
1 parent 4e65b7f commit 5e4950d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
17 changes: 6 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions charts/radix-oauth-guard/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5e4950d

Please sign in to comment.