Skip to content

Commit

Permalink
Merge pull request #46 from mattermost/CLD-7095
Browse files Browse the repository at this point in the history
Use targetplatform, targetarch
  • Loading branch information
stafot committed Feb 5, 2024
2 parents 7ab6721 + 29f3afa commit f76f70f
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 @@ -3,23 +3,15 @@
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 /awat/
COPY . /awat/

# 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
ENV ARCH=${TARGETARCH}
RUN make build ARCH=$ARCH

FROM ${DOCKER_BASE_IMAGE}
FROM --platform=${TARGETPLATFORM} ${DOCKER_BASE_IMAGE}
LABEL name="Mattermost Cloud Automatic Workspace Archive Translator" \
maintainer="cloud-team@mattermost.com" \
vendor="Mattermost" \
Expand Down

0 comments on commit f76f70f

Please sign in to comment.