From 79edfb5974628d3fdc08617519040bba83d21fbd Mon Sep 17 00:00:00 2001 From: James Ranson Date: Thu, 23 Apr 2020 16:52:03 -0600 Subject: [PATCH] use multi-stage to fix cross-arch execution errors --- Dockerfile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3b3da1a..f7f8740 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,22 @@ ARG IMAGE_ARCH=amd64 +# this is needed to change the file permissions on an arm64 build +# since arm64 chown and chmod won't run on an amd64 build host +FROM alpine:3 as permer +ARG GOARCH=amd64 + +COPY ./OPATH/mockster-*.linux-${GOARCH} /usr/local/bin/mockster +RUN chown nobody:nogroup /usr/local/bin/mockster && chmod +x /usr/local/bin/mockster + FROM ${IMAGE_ARCH}/alpine:3 LABEL maintainer "The Trickster Authors " -ARG GOARCH=amd64 # expects that you are in in $src/github.com/tricksterproxy/mockster # and have already ran "make release" for binaries to reside in OPATH -COPY ./OPATH/mockster-*.linux-${GOARCH} /usr/local/bin/mockster +COPY --from=permer /usr/local/bin/mockster /usr/local/bin/mockster COPY LICENSE /LICENSE COPY NOTICE /NOTICE -RUN chown nobody:nogroup /usr/local/bin/mockster && chmod +x /usr/local/bin/mockster - USER nobody EXPOSE 8482 ENTRYPOINT ["/usr/local/bin/mockster"]