diff --git a/Makefile b/Makefile index 7985a7679e..c5e6fc0d2b 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,11 @@ else export IS_LINUX = endif +# Detect M1/M2 Macs and set a flag. +ifeq ($(shell uname)/$(shell uname -m),Darwin/arm64) + M1_MAC = true +endif + define LICENSE_HEADER // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. @@ -177,6 +182,11 @@ ifneq ("$(wildcard ./docker-compose.override.yaml)","") DOCKER_COMPOSE_OVERRIDE=-f docker-compose.override.yaml endif +ifeq ($(M1_MAC),true) + $(info M1 detected, applying elasticsearch override) + DOCKER_COMPOSE_OVERRIDE := -f docker-compose.makefile.m1.yml $(DOCKER_COMPOSE_OVERRIDE) +endif + ifneq ($(DOCKER_SERVICES_OVERRIDE),true) ifeq (,$(findstring minio,$(ENABLED_DOCKER_SERVICES))) TEMP_DOCKER_SERVICES:=$(TEMP_DOCKER_SERVICES) minio @@ -187,7 +197,7 @@ ifneq ($(DOCKER_SERVICES_OVERRIDE),true) endif ifeq (,$(findstring elasticsearch,$(ENABLED_DOCKER_SERVICES))) TEMP_DOCKER_SERVICES:=$(TEMP_DOCKER_SERVICES) elasticsearch - endif + endif endif ENABLED_DOCKER_SERVICES:=$(ENABLED_DOCKER_SERVICES) $(TEMP_DOCKER_SERVICES) endif diff --git a/docker-compose.makefile.m1.yml b/docker-compose.makefile.m1.yml new file mode 100644 index 0000000000..69255bae05 --- /dev/null +++ b/docker-compose.makefile.m1.yml @@ -0,0 +1,13 @@ +version: '2.4' +services: + elasticsearch: + image: "elasticsearch:7.17.3" + platform: linux/arm64/v8 + restart: 'no' + container_name: mattermost-elasticsearch + ports: + - "9200:9200" + - "9300:9300" + extends: + file: build/docker-compose.common.yml + service: elasticsearch