Skip to content

Commit 4cc1a87

Browse files
committed
Move platform detection into docker Makefile
1 parent 1678597 commit 4cc1a87

File tree

3 files changed

+10
-30
lines changed

3 files changed

+10
-30
lines changed

Makefile.docker

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,19 @@ IMAGE =
1919
# -------------------------------------------------------------------------------------------------
2020
NO_CACHE =
2121
ARGS =
22-
ARCH = linux/amd64
2322
DOCKER_TAG = latest
2423
DIR = .
2524
FILE = Dockerfile
2625

26+
# Auto-detect current platform and use it as default to build for
27+
_PLATFORM = $(shell uname -m)
28+
ifeq ($(strip $(_PLATFORM)),x86_64)
29+
ARCH = linux/amd64
30+
else
31+
ifeq ($(strip $(_PLATFORM)),arm64)
32+
ARCH = linux/arm64
33+
endif
34+
endif
2735

2836
# -------------------------------------------------------------------------------------------------
2937
# Targets

Makefile.platform

Lines changed: 0 additions & 27 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ifneq (,)
1212
endif
1313

1414
# Ensure additional Makefiles are present
15-
MAKEFILES = Makefile.docker Makefile.lint Makefile.platform
15+
MAKEFILES = Makefile.docker Makefile.lint
1616
$(MAKEFILES): URL=https://raw.githubusercontent.com/devilbox/makefiles/master/$(@)
1717
$(MAKEFILES):
1818
@if ! (curl --fail -sS -o $(@) $(URL) || wget -O $(@) $(URL)); then \
@@ -27,7 +27,6 @@ include $(MAKEFILES)
2727
```gitignore
2828
Makefile.docker
2929
Makefile.lint
30-
Makefile.platform
3130
```
3231

3332

0 commit comments

Comments
 (0)