1- # DOCKER
1+ # ===== Variables =====
22PACKAGE_VERSION := $(shell jq -r '.version' package.json)
33PACKAGE_MAJOR_VERSION := $(shell echo $(PACKAGE_VERSION ) | cut -d. -f1)
4+ REPO := devthefuture/dockerfile-x
5+ PLATFORMS := linux/amd64,linux/arm64
46
7+ # ===== Docker =====
58setup-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
912docker-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
1215docker-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
1518docker-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 =====
2430go-version :
25- gvm install go1.25
31+ gvm install go1.25 || true
2632 gvm use 1.25
27-
33+
2834go-deps :
2935 go mod tidy
3036 go mod vendor
3137
3238go-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 =====
3844node-deps :
3945 yarn
4046
4147node-build : node-deps
42- yarn build
43-
48+ yarn build
0 commit comments