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

*: Support building multi-arch image #175

Merged
merged 1 commit into from
Mar 8, 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
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the go-tpc binary
FROM golang:1.18 as builder
FROM golang:1.21 as builder

WORKDIR /workspace
COPY go.mod go.mod
Expand All @@ -12,9 +12,10 @@ RUN go mod download
COPY . .

# Build
RUN GOOS=linux GOARCH=amd64 make build
ARG TARGETOS TARGETARCH
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make build

FROM pingcap/alpine-glibc:3.10
FROM alpine

RUN apk add --no-cache \
dumb-init \
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ GOBUILD=$(GO) build -ldflags '$(LDFLAGS)'

# Image URL to use all building/pushing image targets
IMG ?= go-tpc:latest
PLATFORM ?= linux/amd64,linux/arm64

all: format test build

Expand Down Expand Up @@ -42,3 +43,8 @@ docker-build: test

docker-push: docker-build
docker push ${IMG}

# Create multiarch driver if not exists:
# docker buildx create --name multiarch --driver docker-container --use
docker-multiarch: test
docker buildx build --platform ${PLATFORM} . -t ${IMG} --push
Loading