Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OKE-28119 : Multi arch support #39

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,28 @@ jobs:
IMAGE_REGISTRY: ghcr.io/oracle
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
with:
platforms: amd64
platforms: linux/amd64,linux/arm64

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

- name: Log into GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${GITHUB_ACTOR,,} --password-stdin

- name: Build Image
run: REGISTRY="${{ env.IMAGE_REGISTRY }}" VERSION="${{ github.ref_name }}" make image
- name: Login to Docker
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push Image
run: REGISTRY="${{ env.IMAGE_REGISTRY }}" VERSION="${{ github.ref_name }}" make push
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
provenance: false
tags: ghcr.io/oracle/oci-native-ingress-controller:${{ github.ref_name }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ COPY . ./
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
#RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod vendor -a -o dist/onic ./main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -mod vendor -a -o dist/onic ./main.go

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

ENTRYPOINT ["/usr/local/bin/oci-native-ingress-controller/onic"]
ENTRYPOINT ["/usr/local/bin/oci-native-ingress-controller/onic"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ version:

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

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

push:
docker push ${IMAGE_PATH}
Expand Down
Loading