Skip to content

Commit 4413e97

Browse files
committed
Re-work building
1 parent a7a6b42 commit 4413e97

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

Makefile

+22-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
DOCKER_TAG ?= latest
21
IMAGE_TAG ?= wdes/mail-autodiscover-autoconfig
2+
# All: linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/mips64le,linux/ppc64le,linux/s390x
3+
# Supported by rust (Debian variant, alpine has 2 less): linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8
4+
# Supported by alpine: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
5+
PLATFORM ?= linux/amd64
36

4-
.PHONY: build build-docker push-docker test format
7+
ACTION ?= load
8+
PROGRESS_MODE ?= plain
9+
EXTRA_ARGS ?=
10+
11+
.PHONY: build build-release test test-coverage validate format docker-build
512

613
build:
714
@cargo build
@@ -29,11 +36,16 @@ validate:
2936
format:
3037
@cargo fmt -- --emit files
3138

32-
build-docker:
33-
@echo "Build arguments: ${BUILD_ARGS}"
34-
docker build --pull -f ./alpine/Dockerfile ./ -t "${IMAGE_TAG}:${DOCKER_TAG}" --build-arg BUILD_DATE="$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")" --build-arg VCS_REF="$(shell git rev-parse HEAD)" --build-arg RELEASE_VERSION="$(shell grep -P -m 1 '^version = ".*"$$' Cargo.toml | cut -d '"' -f 2)"
35-
36-
push-docker:
37-
@echo "Pushing to ${IMAGE_TAG}:${DOCKER_TAG} in 2sec"
38-
@sleep 2
39-
docker push "${IMAGE_TAG}:${DOCKER_TAG}"
39+
docker-build:
40+
# https://github.com/docker/buildx#building
41+
docker buildx build \
42+
--tag $(IMAGE_TAG) \
43+
--progress $(PROGRESS_MODE) \
44+
--platform $(PLATFORM) \
45+
--build-arg VCS_REF="$(shell git rev-parse HEAD)" \
46+
--build-arg BUILD_DATE="$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")" \
47+
--build-arg RELEASE_VERSION="$(shell grep -P -m 1 '^version = ".*"$$' Cargo.toml | cut -d '"' -f 2)" \
48+
--$(ACTION) \
49+
$(EXTRA_ARGS) \
50+
--file docker/Dockerfile \
51+
./
File renamed without changes.

0 commit comments

Comments
 (0)