File tree Expand file tree Collapse file tree 3 files changed +23
-13
lines changed Expand file tree Collapse file tree 3 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -111,12 +111,19 @@ jobs:
111111 with :
112112 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
113113
114+ - name : Set up QEMU
115+ uses : docker/setup-qemu-action@v3
116+
117+ - name : Set up Docker Buildx
118+ uses : docker/setup-buildx-action@v3
119+
114120 - name : Build and push Docker image
115121 id : push
116122 uses : docker/build-push-action@v6
117123 with :
118124 context : .
119125 push : true
126+ platforms : linux/amd64,linux/arm64
120127 tags : ${{ steps.meta.outputs.tags }}
121128 labels : ${{ steps.meta.outputs.labels }}
122129
Original file line number Diff line number Diff line change 11FROM golang:latest AS builder
22
3+ ARG TARGETOS
4+ ARG TARGETARCH
5+
36ENV GO111MODULE=on \
7+ GOOS=${TARGETOS} \
8+ GOARCH=${TARGETARCH} \
49 CGO_ENABLED=0
510
611WORKDIR /build
@@ -11,16 +16,11 @@ COPY go.sum .
1116RUN go mod download
1217
1318COPY . .
14- RUN make build
19+ RUN OS=${TARGETOS} ARCH=${TARGETARCH} make build
1520
1621WORKDIR /dist
1722
1823RUN cp /build/cortex-tenant ./cortex-tenant
19-
20- RUN ldd cortex-tenant | tr -s '[:blank:]' '\n ' | grep '^/' | \
21- xargs -I % sh -c 'mkdir -p $(dirname ./%); cp % ./%;'
22- RUN mkdir -p lib64 && cp /lib64/ld-linux-x86-64.so.2 lib64/
23-
2424RUN mkdir /data && cp /build/deploy/cortex-tenant.yml /data/cortex-tenant.yml
2525
2626FROM scratch
Original file line number Diff line number Diff line change @@ -10,13 +10,16 @@ RELEASE := 1
1010GO ?= go
1111OUT := .out
1212
13+ OS ?= linux
14+ ARCH ?= amd64
15+
1316all : rpm deb
1417
1518build :
16- go test ./... && \
17- GOARCH=amd64 \
18- GOOS=linux \
19- CGO_ENABLED=0 \
19+ export GOARCH= $( ARCH )
20+ export GOOS= $( OS )
21+ export CGO_ENABLED=0
22+ go test ./...
2023 $(GO ) build -ldflags " -s -w -extldflags \" -static\" -X main.Version=$( VERSION) "
2124
2225prepare :
@@ -47,12 +50,12 @@ build-rpm:
4750 --iteration $(RELEASE) \
4851 --force \
4952 --rpm-compression bzip2 \
50- --rpm-os linux \
53+ --rpm-os $(OS) \
5154 --url $(URL) \
5255 --description "$(DESCRIPTION)" \
5356 -m "$(MAINTAINER)" \
5457 --license "$(LICENSE)" \
55- -a amd64 \
58+ -a $(ARCH) \
5659 .
5760
5861build-deb :
@@ -76,5 +79,5 @@ build-deb:
7679 --description "$(DESCRIPTION)" \
7780 -m "$(MAINTAINER)" \
7881 --license "$(LICENSE)" \
79- -a amd64 \
82+ -a $(ARCH) \
8083 .
You can’t perform that action at this time.
0 commit comments