multiarch (alpine)

Add one more BUILDPLATFORM as needed for down build
+ x1 more (try again) and it's linux/${TARGETARCH}

I thought that ${TARGETPLATFORM} was a thing according to this blog:
https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/
but it doesn't seem to be there reliably, whereas ${TARGETARCH} is set.

Signed-off-by: Kingdon Barrett <kingdon@weave.works>
This commit is contained in:
Kingdon Barrett committed 2023-03-29 15:42:12 -04:00
1 parent 88d8bb648f
commit e84a000b92
1 file changed
+4 -4
+4 -4
View File
@@ -7,7 +7,7 @@ ARG ALPINE_BASEIMAGE=alpine:3.17.2
# It will be built only once for a given build platform. Subsequent
# stages will start from this and cross-compile for each target
# architecture.
FROM --platform=$BUILDPLATFORM golang:1.20.2-bullseye AS builderbase
FROM --platform=${BUILDPLATFORM} golang:1.20.2-bullseye AS builderbase
# Support Raspberry Pi 2 and newer
ENV GOARM 7
@@ -77,7 +77,7 @@ EOMAKE
# Stage 3: Alpine Base
# This stage exists in case there are any additional tweaks
# required in the alpine base image.
FROM ${ALPINE_BASEIMAGE} as alpinebase
FROM --platform=linux/${TARGETARCH} ${ALPINE_BASEIMAGE} as alpinebase
# Any additional tweaks will appear here
# End Stage 3
########
@@ -250,10 +250,10 @@ LABEL org.opencontainers.image.revision="${revision}" \
# See the License for the specific language governing permissions and
# limitations under the License.
FROM bash AS networktesterimage
FROM --platform=linux/${TARGETARCH} bash AS networktesterimage
RUN apk add --no-cache curl bind-tools
COPY --from=builder /root/weave/test/images/network-tester/webserver webserver
EXPOSE 8080
ENTRYPOINT ["/webserver"]
# End Stage 9
########
########