Skip to content

Commit d9394c2

Browse files
authored
Multi arch support (#39)
1 parent 575e0d0 commit d9394c2

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

.github/workflows/release.yaml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,28 @@ jobs:
2020
IMAGE_REGISTRY: ghcr.io/oracle
2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v3.3.0
23+
uses: actions/checkout@v4
2424

2525
- name: Set up QEMU
26-
uses: docker/setup-qemu-action@v2
26+
uses: docker/setup-qemu-action@v3
2727
with:
28-
platforms: amd64
28+
platforms: linux/amd64,linux/arm64
2929

3030
- name: Set up Docker Buildx
31-
uses: docker/setup-buildx-action@v2
31+
uses: docker/setup-buildx-action@v3
3232

33-
- name: Log into GitHub Container Registry
34-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${GITHUB_ACTOR,,} --password-stdin
35-
36-
- name: Build Image
37-
run: REGISTRY="${{ env.IMAGE_REGISTRY }}" VERSION="${{ github.ref_name }}" make image
33+
- name: Login to Docker
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
3839

39-
- name: Push Image
40-
run: REGISTRY="${{ env.IMAGE_REGISTRY }}" VERSION="${{ github.ref_name }}" make push
40+
- name: Build and push
41+
uses: docker/build-push-action@v5
42+
with:
43+
context: .
44+
platforms: linux/amd64,linux/arm64
45+
push: true
46+
provenance: false
47+
tags: ghcr.io/oracle/oci-native-ingress-controller:${{ github.ref_name }}

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ COPY . ./
1818
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
1919
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
2020
#RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager main.go
21-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod vendor -a -o dist/onic ./main.go
21+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -mod vendor -a -o dist/onic ./main.go
2222

2323
# For Open source
2424
FROM oraclelinux:7-slim
@@ -34,4 +34,4 @@ COPY THIRD_PARTY_LICENSES.txt .
3434
# Copy the manager binary
3535
COPY --from=builder /workspace/dist/onic .
3636

37-
ENTRYPOINT ["/usr/local/bin/oci-native-ingress-controller/onic"]
37+
ENTRYPOINT ["/usr/local/bin/oci-native-ingress-controller/onic"]

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ version:
5959

6060
# Currently only supports amd
6161
build: ./main.go
62-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod vendor -a -o dist/onic ./main.go
62+
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) GO111MODULE=on go build -mod vendor -a -o dist/onic ./main.go
6363

6464
image:
65-
docker build -t ${IMAGE_PATH} -f Dockerfile .
65+
docker build --build-arg goos=$(GOOS) --build-arg goarch=$(GOARCH) -t ${IMAGE_PATH} -f Dockerfile .
6666

6767
push:
6868
docker push ${IMAGE_PATH}

0 commit comments

Comments
 (0)