chore(make): use buildx to build multi-arch image
This commit is contained in:
parent
f43d01bbd5
commit
954edb1c00
2 changed files with 4 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
FROM golang:1.19-alpine as gobuild
|
FROM golang:1.19-alpine AS gobuild
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
ADD go.mod go.sum /build/
|
ADD go.mod go.sum /build/
|
||||||
|
@ -9,7 +9,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o ./s
|
||||||
|
|
||||||
FROM alpine:3.17
|
FROM alpine:3.17
|
||||||
|
|
||||||
ARG ARCH=amd64
|
ARG BUILDARCH
|
||||||
|
|
||||||
LABEL maintainers="Vitaliy Filippov <vitalif@yourcmc.ru>"
|
LABEL maintainers="Vitaliy Filippov <vitalif@yourcmc.ru>"
|
||||||
LABEL description="csi-s3 slim image"
|
LABEL description="csi-s3 slim image"
|
||||||
|
@ -17,7 +17,7 @@ LABEL description="csi-s3 slim image"
|
||||||
RUN apk add --no-cache fuse mailcap rclone
|
RUN apk add --no-cache fuse mailcap rclone
|
||||||
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community s3fs-fuse
|
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community s3fs-fuse
|
||||||
|
|
||||||
ADD https://github.com/yandex-cloud/geesefs/releases/latest/download/geesefs-linux-${ARCH} /usr/bin/geesefs
|
ADD https://github.com/yandex-cloud/geesefs/releases/latest/download/geesefs-linux-${BUILDARCH} /usr/bin/geesefs
|
||||||
RUN chmod 755 /usr/bin/geesefs
|
RUN chmod 755 /usr/bin/geesefs
|
||||||
|
|
||||||
COPY --from=gobuild /build/s3driver /s3driver
|
COPY --from=gobuild /build/s3driver /s3driver
|
||||||
|
|
5
Makefile
5
Makefile
|
@ -27,10 +27,7 @@ test:
|
||||||
docker build -t $(TEST_IMAGE_TAG) -f test/Dockerfile .
|
docker build -t $(TEST_IMAGE_TAG) -f test/Dockerfile .
|
||||||
docker run --rm --privileged -v $(PWD):/build --device /dev/fuse $(TEST_IMAGE_TAG)
|
docker run --rm --privileged -v $(PWD):/build --device /dev/fuse $(TEST_IMAGE_TAG)
|
||||||
container:
|
container:
|
||||||
docker buildx build --build-arg ARCH=amd64 --push --platform linux/amd64 -t $(IMAGE_TAG)-amd64 .
|
docker buildx build --push --platform linux/amd64,linux/arm64 -t $(IMAGE_TAG) .
|
||||||
docker buildx build --build-arg ARCH=arm64 --push --platform linux/arm64 -t $(IMAGE_TAG)-arm64 .
|
|
||||||
docker manifest create --amend $(IMAGE_TAG) $(IMAGE_TAG)-amd64 $(IMAGE_TAG)-arm64
|
|
||||||
docker manifest push --purge $(IMAGE_TAG)
|
|
||||||
push: container
|
push: container
|
||||||
docker tag $(IMAGE_TAG) $(REGISTRY_NAME)/$(IMAGE_NAME):latest
|
docker tag $(IMAGE_TAG) $(REGISTRY_NAME)/$(IMAGE_NAME):latest
|
||||||
docker tag $(IMAGE_TAG) $(REGISTRY_NAME)/$(IMAGE_NAME2):$(VERSION)
|
docker tag $(IMAGE_TAG) $(REGISTRY_NAME)/$(IMAGE_NAME2):$(VERSION)
|
||||||
|
|
Loading…
Reference in a new issue