Skip to content

Commit 34cbe06

Browse files
committed
chore: cleanup Makefile
1 parent fa51e82 commit 34cbe06

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

Makefile

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,48 @@
1-
# DOCKER
1+
# ===== Variables =====
22
PACKAGE_VERSION := $(shell jq -r '.version' package.json)
33
PACKAGE_MAJOR_VERSION := $(shell echo $(PACKAGE_VERSION) | cut -d. -f1)
4+
REPO := devthefuture/dockerfile-x
5+
PLATFORMS := linux/amd64,linux/arm64
46

7+
# ===== Docker =====
58
setup-docker-multiarch:
6-
docker buildx create --use --name mybuilder --driver docker-container
9+
docker buildx create --use --name mybuilder --driver docker-container || true
710
docker buildx inspect mybuilder --bootstrap
811

912
docker-build-dev:
10-
docker buildx build --platform linux/amd64 -t devthefuture/dockerfile-x:dev --progress=plain . --push
13+
docker buildx build --progress=plain --platform linux/amd64 -t $(REPO):dev . --push
1114

1215
docker-build:
13-
docker buildx build --platform linux/amd64,linux/arm64 -t devthefuture/dockerfile-x --progress=plain .
16+
docker buildx build --progress=plain --platform $(PLATFORMS) -t $(REPO) .
1417

1518
docker-push:
16-
docker buildx build --platform linux/amd64,linux/arm64 -t devthefuture/dockerfile-x --progress=plain . --push
17-
docker buildx build --platform linux/amd64,linux/arm64 -t devthefuture/dockerfile-x:v$(PACKAGE_MAJOR_VERSION) --progress=plain . --push
18-
docker buildx build --platform linux/amd64,linux/arm64 -t devthefuture/dockerfile-x:v$(PACKAGE_VERSION) --progress=plain . --push
19-
docker buildx build --platform linux/amd64,linux/arm64 -t devthefuture/dockerfile-x:$(PACKAGE_MAJOR_VERSION) --progress=plain . --push
20-
docker buildx build --platform linux/amd64,linux/arm64 -t devthefuture/dockerfile-x:$(PACKAGE_VERSION) --progress=plain . --push
21-
22-
# GO
23-
19+
docker buildx build \
20+
--progress=plain \
21+
--platform $(PLATFORMS) \
22+
-t $(REPO) \
23+
-t $(REPO):$(PACKAGE_MAJOR_VERSION) \
24+
-t $(REPO):v$(PACKAGE_MAJOR_VERSION) \
25+
-t $(REPO):$(PACKAGE_VERSION) \
26+
-t $(REPO):v$(PACKAGE_VERSION) \
27+
. --push
28+
29+
# ===== Go =====
2430
go-version:
25-
gvm install go1.25
31+
gvm install go1.25 || true
2632
gvm use 1.25
27-
33+
2834
go-deps:
2935
go mod tidy
3036
go mod vendor
3137

3238
go-build:
33-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod vendor -ldflags '-w -extldflags "-static"' -o dist-bin/dockerfile-x-frontend .
34-
35-
36-
# NODE
39+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
40+
go build -mod=vendor -trimpath -ldflags='-s -w -extldflags "-static"' \
41+
-o dist-bin/dockerfile-x-frontend .
3742

43+
# ===== Node =====
3844
node-deps:
3945
yarn
4046

4147
node-build: node-deps
42-
yarn build
43-
48+
yarn build

0 commit comments

Comments
 (0)