Skip to content

Commit c625682

Browse files
authored
Adapt image to multi-arch arm,amd (#7)
* Multi-arch build * clean before build, as --manifest is additive
1 parent c39f7d0 commit c625682

2 files changed

Lines changed: 28 additions & 5 deletions

File tree

Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
FROM golang:1.15-alpine AS builder
1+
FROM --platform=$BUILDPLATFORM golang:1.15-alpine AS builder
2+
3+
ARG TARGETOS
4+
ARG TARGETARCH
5+
26
RUN mkdir /build
37
ADD . /build
48
WORKDIR /build
5-
RUN go build -o tcp-go-echo .
9+
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o tcp-go-echo .
610

7-
8-
FROM alpine
11+
FROM --platform=$TARGETPLATFORM alpine
912
RUN mkdir /app
1013
WORKDIR /app
1114
COPY --from=builder /build/tcp-go-echo /app
1215
CMD ["/app/tcp-go-echo"]
13-

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
IMAGE_NAME = quay.io/skupper/tcp-go-echo
3+
PLATFORM = linux/amd64,linux/arm64
4+
5+
# The option below creates the images in the docker format.
6+
# That is required for their use with Openshift 3.11
7+
FORMAT_OPTIONS = --format docker
8+
9+
.DEFAULT_GOAL := build
10+
11+
build: clean
12+
podman build --no-cache --platform $(PLATFORM) --manifest $(IMAGE_NAME) $(FORMAT_OPTIONS) .
13+
14+
push:
15+
podman manifest push $(IMAGE_NAME)
16+
17+
clean:
18+
-podman manifest rm $(IMAGE_NAME)
19+
20+
check:
21+
podman manifest inspect $(IMAGE_NAME)

0 commit comments

Comments
 (0)