Skip to content

Commit

Permalink
Use targetplatform, targetarch
Browse files Browse the repository at this point in the history
Signed-off-by: Stavros Foteinopoulos <[email protected]>
  • Loading branch information
stafot committed Feb 5, 2024
1 parent 98653ee commit 36a89c0
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,18 @@
ARG DOCKER_BUILD_IMAGE=golang:1.20
ARG DOCKER_BASE_IMAGE=alpine:3.19

FROM ${DOCKER_BUILD_IMAGE} AS build
FROM --platform=${TARGETPLATFORM} ${DOCKER_BUILD_IMAGE} AS build
ARG TARGETARCH
WORKDIR /elrond/
COPY . /elrond/
ENV ARCH=${TARGETARCH}

# Detect architecture and set ARCH
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then \
ARCH="amd64"; \
elif [ "$ARCH" = "aarch64" ]; then \
ARCH="arm64"; \
elif [ "$ARCH" = "armv7l" ] || [ "$ARCH" = "armv6l" ]; then \
ARCH="arm"; \
fi && \
echo "ARCH=$ARCH" && \
make build ARCH=$ARCH
RUN make build ARCH=${ARCH}
RUN apt-get update -yq && apt-get install -yq unzip


# Final Image
FROM ${DOCKER_BASE_IMAGE}
FROM --platform=${TARGETPLATFORM} ${DOCKER_BASE_IMAGE}
LABEL name="Mattermost Elrond" \
maintainer="[email protected]" \
vendor="Mattermost" \
Expand Down

0 comments on commit 36a89c0

Please sign in to comment.