From ac03c0efed3f8b962043fe22842471180911467c Mon Sep 17 00:00:00 2001 From: Guilherme Caulada Date: Thu, 23 Mar 2023 12:03:25 -0300 Subject: [PATCH] Docker: Allow docker-build-full to work for BSD and GNU based systems (#65216) * Replace tmp folder for tar stdin on build-docker-full * Fix building linux/arm64 images using the Dockerfile Introduces JS_PLATFORM variable with linux/amd64 as default to allow building node packages. * Revert unintended white line changes on Dockerfile --- Dockerfile | 3 ++- Makefile | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 29b1a319bc9..704d070369b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,13 @@ ARG BASE_IMAGE=alpine:3.17 ARG JS_IMAGE=node:18-alpine3.17 +ARG JS_PLATFORM=linux/amd64 ARG GO_IMAGE=golang:1.20.1-alpine3.17 ARG GO_SRC=go-builder ARG JS_SRC=js-builder -FROM ${JS_IMAGE} as js-builder +FROM --platform=${JS_PLATFORM} ${JS_IMAGE} as js-builder ENV NODE_OPTIONS=--max_old_space_size=8000 diff --git a/Makefile b/Makefile index 90feb7749b8..5d5d9f4387b 100644 --- a/Makefile +++ b/Makefile @@ -165,15 +165,13 @@ shellcheck: $(SH_FILES) ## Run checks for shell scripts. ##@ Docker -TMP_DIR!=mktemp -d TAG_SUFFIX=$(if $(WIRE_TAGS)!=oss,-$(WIRE_TAGS)) PLATFORM=linux/amd64 build-docker-full: ## Build Docker image for development. @echo "build docker container" - cp -Lrf . $(TMP_DIR) - DOCKER_BUILDKIT=1 \ - docker build $(TMP_DIR) \ + tar -ch . | \ + docker buildx build - \ --platform $(PLATFORM) \ --build-arg BINGO=false \ --build-arg GO_BUILD_TAGS=$(GO_BUILD_TAGS) \ @@ -183,9 +181,8 @@ build-docker-full: ## Build Docker image for development. build-docker-full-ubuntu: ## Build Docker image based on Ubuntu for development. @echo "build docker container" - cp -Lrf . $(TMP_DIR) - DOCKER_BUILDKIT=1 \ - docker build $(TMP_DIR) \ + tar -ch . | \ + docker buildx build - \ --platform $(PLATFORM) \ --build-arg BINGO=false \ --build-arg GO_BUILD_TAGS=$(GO_BUILD_TAGS) \