Skip to content

Commit

Permalink
arm64/amd64 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmadigan committed Mar 27, 2024
1 parent 3e00d73 commit c809d26
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PROJECT := github.com/jasonmadigan/podman-mac-net-connect
SETUP_IMAGE := quay.io/jasonmadigan/podman-mac-net-connect
SETUP_IMAGE := quay.io/jmadigan/podman-mac-net-connect
VERSION := 0.0.1
LD_FLAGS := -X ${PROJECT}/version.Version=${VERSION} -X ${PROJECT}/version.SetupImage=${SETUP_IMAGE}

Expand All @@ -12,8 +12,20 @@ run-go::
build-go::
go build -ldflags "-s -w ${LD_FLAGS}" ${PROJECT}

# Building for amd64 and arm64
build-podman::
podman build -t ${SETUP_IMAGE}:${VERSION} ./client
# Build for amd64
podman build --arch=amd64 -f ./client/Dockerfile.amd64 -t ${SETUP_IMAGE}:${VERSION}-amd64 ./client
podman push ${SETUP_IMAGE}:${VERSION}-amd64
# Build for arm64
podman build --arch=arm64 -f ./client/Dockerfile.arm64 -t ${SETUP_IMAGE}:${VERSION}-arm64 ./client
podman push ${SETUP_IMAGE}:${VERSION}-arm64
# Create and push manifest
podman manifest create ${SETUP_IMAGE}:${VERSION}
podman manifest add ${SETUP_IMAGE}:${VERSION} docker://${SETUP_IMAGE}:${VERSION}-amd64
podman manifest add ${SETUP_IMAGE}:${VERSION} docker://${SETUP_IMAGE}:${VERSION}-arm64
podman manifest push --all ${SETUP_IMAGE}:${VERSION} docker://${SETUP_IMAGE}:${VERSION}

build-push-quay::
podman buildx build --platform linux/amd64,linux/arm64 --push -t ${SETUP_IMAGE}:${VERSION} ./client

# Simplified target for pushing to Quay, relies on build-podman for actual build and push steps
build-push-quay:: build-podman
3 changes: 1 addition & 2 deletions client/Dockerfile → client/Dockerfile.amd64
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ RUN go build -o app main.go
FROM debian:11-slim

RUN apt-get update && apt-get install -y \
iptables \
kmod
iptables

COPY --from=build /build/app .

Expand Down
20 changes: 20 additions & 0 deletions client/Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM golang:1.17 as build

WORKDIR /build

COPY go.* .

RUN go mod download

COPY . .

RUN go build -o app main.go

FROM debian:11-slim

RUN apt-get update && apt-get install -y \
iptables

COPY --from=build /build/app .

CMD ["./app"]

0 comments on commit c809d26

Please sign in to comment.